Communicating with external processes in D

Jesse Phillips via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Tue Nov 24 12:05:46 PST 2015


On Monday, 23 November 2015 at 20:02:16 UTC, Cameron Reid wrote:
> I'm rather new to D, so apologies if this is a silly question:
>
> I'd like to be able to fork a number of instances of a process, 
> write to their stdins and read from their stdouts in parallel. 
> That is, I want to write some data to the stdin of all these 
> processes and collect lines written to their stdouts as soon as 
> they're emitted by the process.
>
> I tried for quite a while last night using permutations of 
> pipeProcess and i/o redirection but nothing did exactly what I 
> was looking for.
>
> Is such a thing possible? If so, where might I go to educate 
> myself?

pipeProcess will give you the input/output pair (and believe the 
output is accessible at the available time the program writes a 
line). To publish the same input to multiple pipes will be 
something have to create along with a receiver of multiple 
outputs.

That is to say, you can do it, but managing read/write is on you.


More information about the Digitalmars-d-learn mailing list