Avoid zombie processes with std.process

Shachar Shemesh via Digitalmars-d digitalmars-d at puremagic.com
Thu Aug 25 07:53:30 PDT 2016


On 25/08/16 11:46, FreeSlave wrote:
> On Thursday, 25 August 2016 at 07:32:29 UTC, Shachar Shemesh wrote:
>> On 24/08/16 14:04, FreeSlave wrote:
>>> Are there plans on adding something like spawnProcessDetached that would
>>> start processes completely independent from parent? I.e. in other
>>> process group and, what is important, with no need for wait.
>>>
>>> On Posix that could be done via double fork technique. Not sure about
>>> Windows.
>>
>> Double fork on Posix is, usually, used for something slightly
>> different. In particular, since you bring up the process group, I
>> think you mean daemonization.
>>
>> Daemonization, however, does a bit more than create a new process
>> group and double forking.
>>
>> http://forum.dlang.org/thread/d83ugn$265f$1@digitaldaemon.com has
>> discussion and some code regarding this issue.
>>
>> Shachar
>
> It's not about daemonization only. Different process group is needed to
> prevent signal distribution. Again, e.g. file manager and launched
> application may want to not be connected in any way.

Yes, that's part of daemonization. So is chdir somewhere else and 
closing all open file descriptors, including stdin/out/err.

http://0pointer.de/public/systemd-man/daemon.html#SysV%20Daemons


More information about the Digitalmars-d mailing list