Simplifying process piping

Vladimir Panteleev thecybershadow.lists at gmail.com
Sun Sep 22 16:54:02 UTC 2019


On Sunday, 22 September 2019 at 16:06:04 UTC, Jesse Phillips 
wrote:
> https://github.com/JesseKPhillips/std.process-example/
>
> I'm wondering if there are any thoughts for simplification. I 
> don't mean simplify to perform the same end result, but is the 
> threading and data copies as simple as they could be? Did I 
> misrepresent anything?

Your approach is OK for more complicated cases. When you need to 
just pipe one process into another, create a `pipe`, pass the 
writeEnd to the first process's stderr, and the readEnd to the 
second process's stdin. To discard output, pass File("/dev/null", 
"w") to its stdout.

There is a ticket somewhere in Bugzilla to add something like 
Python's Popen.communicate to pipe multiple things at once. it is 
not difficult, on Linux it is a select loop, doesn't even require 
threads. There was no consensus on what the interface should look 
like.



More information about the Digitalmars-d-learn mailing list