std.process: spawnProcess
Andrea Fontana
nospam at example.com
Fri Sep 7 15:53:27 UTC 2018
On Friday, 7 September 2018 at 14:36:42 UTC, Russel Winder wrote:
> From what I can see, processes created with std.process:
> spawnProcess are not terminated when the creating process
> terminates, i.e. it seems Config.detached is the default for
> these process.
>
> Is there a way of all spawned processes being terminated on
> main termination?
void main()
{
...
auto yourpid = spawnProcess(...);
scope(exit) kill(yourpid, SIGINT); // Or SIGKILL :)
// Or: scope(exit) wait(yourpid);
...
}
Andrea
More information about the Digitalmars-d-learn
mailing list