July 12, 2011
i am just in the middle of my first little d project. i came to the point where i have to start new processes command line style incl arguments. they need to run independent of the main program, i.e., several such processes need to be started and must run parallel while the main program continues and maybe even finishes.

in c/c++ (M$ VS2005, e.g.) this can be achieved using one of the spawnXXX functions with mode=P_DISPATCH (value 4).

phobos has a similar function std.process.spawnvp, however, P_DISPATCH doesn't seem to be supported (not defined and when using '4L' anyway resulting in a crash).

so the main question is: what do i do instead? (win32 system)


also i noticed that std.process.spawnvp with mode=P_NOWAIT seems to be broken. it behaves as if mode=P_WAIT: the parent thread is halted until child thread has finished. if this at least would be multithreaded i might be able to live with it (and let the parent process silently wait in the background even though it is done).

thx,  det
July 12, 2011
hm, seems like i am getting somewhere using

std.process.system( "start " ~ mycommandlinestring );

now i have to factor in the issues with the proper quotation of the arguments...



On 2011-07-12 21:19, captaindet wrote:
> i am just in the middle of my first little d project. i came to the
> point where i have to start new processes command line style incl
> arguments. they need to run independent of the main program, i.e.,
> several such processes need to be started and must run parallel while
> the main program continues and maybe even finishes.
>
> in c/c++ (M$ VS2005, e.g.) this can be achieved using one of the
> spawnXXX functions with mode=P_DISPATCH (value 4).
>
> phobos has a similar function std.process.spawnvp, however,
> P_DISPATCH doesn't seem to be supported (not defined and when using
> '4L' anyway resulting in a crash).
>
> so the main question is: what do i do instead? (win32 system)
>
>
> also i noticed that std.process.spawnvp with mode=P_NOWAIT seems to
> be broken. it behaves as if mode=P_WAIT: the parent thread is halted
> until child thread has finished. if this at least would be
> multithreaded i might be able to live with it (and let the parent
> process silently wait in the background even though it is done).
>
> thx, det