Spawn detached processes with no need to wait on them
To use this package, put the following dependency into your project's dependencies section:
This package provides sub packages which can be used individually:
detached:spawn - A minimal D application.
Spawn detached processes in D.
Note: Phobos got this kind of functionality in version 2.076, so this library is no longer needed. Use spawnProcess with Config.detached flag instead. If Config.detached is available during the compilation this library fallbacks to the Phobos version.
Before version 2.076 standard D library did not provide a way to start detached process and required to wait on a returned Pid. Without waiting you would have got zombie processes (resource leakage) if parent process outlives its child.
detached solves this problem by introducing the spawnProcessDetached function which has almost the same API as spawnProcess.
- Run process detached, i.e. with no need to wait.
- Actually reports errors from exec- functions unlike spawnProcess which just checks if executable and working directory exist before fork and hopes their states leave unchanged before exec. (Note: this is no longer the case. It was fixed in phobos 2.075)
A way to close standard streams in spawned process (e.g. for daemon creation).
Simple program demonstrating the usage of spawnProcessDetached.
dub run :spawn -- --workdir=/usr/local -- pwd dub run :spawn -- --stdout=/dev/null --stderr=/dev/null -- vlc dub run :spawn -- -v HELLO=WORLD -- sh -c 'echo $HELLO'
- Registered by Roman Chistokhodov
- 0.1.7 released 11 months ago
- Copyright © 2016, Roman Chistokhodov
- Sub packages:
0.1.7 2017-Sep-02 0.1.6 2017-Jun-26 0.1.5 2017-Jun-18 0.1.4 2017-Mar-19 0.1.3 2017-Mar-17
- Download Stats:
0 downloads today
0 downloads this week
0 downloads this month
171 downloads total
- Short URL: