Communicating with external processes in D

Quentin Ladeveze via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Mon Nov 23 12:11:47 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?

Take a look at message passing concurrency 
(http://ddili.org/ders/d.en/concurrency.html). You can make a 
program that automatically send what its stdin as a message to 
the owner thread and that can receive messages to print to stdout


More information about the Digitalmars-d-learn mailing list