std.process - POSIX specific callback
    nazriel 
    spam at dzfl.pl
       
    Thu Jun  6 09:05:14 PDT 2013
    
    
  
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? ;)
    
    
More information about the Digitalmars-d
mailing list