RejectedSoftware Forums

Sign up

How to wait for std.process

Hi,

How can I yield a Task until an externally spawned process has finished?

I.e. I want to use something similar to https://dlang.org/phobos/std_process.html in order to execute a shell command from my program, and I want to pass execution on to different tasks while waiting.

How do I accomplish this?

-Øivind

Re: How to wait for std.process

Am 14.10.2016 um 03:36 schrieb Øivind Loe:

Hi,

How can I yield a Task until an externally spawned process has finished?

I.e. I want to use something similar to https://dlang.org/phobos/std_process.html in order to execute a shell command from my program, and I want to pass execution on to different tasks while waiting.

How do I accomplish this?

-Øivind

I wrote a thread based wrapper a while ago:
https://gist.github.com/s-ludwig/8434299

In theory the thread could be replaced by waiting on the process/pipe
handles in an event loop compatible way, but that is event loop/OS
specific and in my case the overhead of creating a thread was negligible.