Is there an example of branching and subprocess communication in D?

How do you develop and communicate with the subprocess in D?

I think I'm very looking for http://erdani.com/d/new-stdio/phobos-prerelease/std_process.html#pipeProcess , but pipeProcess does not seem to be in D2.

I want to execute a child process and be able to read from its stdout and stderr, write it to stdin and receive a notification about this exit and its exit code.

What is the best way to do this in D?

Thanks,

Chris.

+4
source share
2 answers

In the end, this functionality will be in Phobos, but for now, here is the class I chose: Pastebin link

You use it as follows:

auto stream = new ProcessStream("ls -a"); // read, write, etc. from stream 
+5
source

Currently, the same as in C. pipe, fork, exec.

Not really.

+2
source

All Articles