Would it be possible to add to std.process.Config POSIX specific callback which would be called after fork()?

It is currently main blocker in switching dpaste-be from handmade process handling module to std.process.

It could look something like this.

struct Config {
     // current fields
     void delegate() posixCallback;
}

// ...

int i = fork();
if (i > 0)
{
//...
   if (config.posixCallback !is null)
        config.posixCallback();
//...
}

Such construct would allow for various child process manipulation, for instance
dropping root privileges or setting limits via setrmlimit.

Example:

config.posixCallback = {
    setguid(ourGUID);
    setgroups(ourGROUPS);
    setuid(ourUID);

    setrmlimit(NFORK, 123);
};


AFAIK we already have Windows specific flag related to spawning console for GUI apps.

I can make pull request ASAP when I get reasonable name for field.

Lars? ;)

Reply via email to