pike.git / lib / modules / Process.pmod

version» Context lines:

pike.git/lib/modules/Process.pmod:1093: Inside #if undefined(__NT__) and #if constant(fork) && constant(exece)
   return pid->wait();    }       // void set_done_callback(function foo,mixed ... args);    // int result();    // array rusage();   }   #endif   #endif    - private void low_daemon(int nochdir, int noclose) + private int low_daemon(int nochdir, int noclose)   {   #if System.daemon    return System.daemon(nochdir, noclose);   #else    if (fork())    exit(0);      #if System.setsid    System.setsid();   #endif /* System.setsid */
pike.git/lib/modules/Process.pmod:1117:       Stdio.File fd;    if (!noclose && (fd = Stdio.File("/dev/null", "rw")))    {    fd->dup2(Stdio.stdin);    fd->dup2(Stdio.stdout);    fd->dup2(Stdio.stderr);    if (fd->query_fd() > 2)    fd->close();    } +  return 0;   #endif /* !System.daemon */   }      void daemon(int nochdir, int noclose,    void|mapping(string:string|Stdio.File) modifiers)   //! A function to run current program in the background.   //!   //! @param nochdir   //! If 0 the process will continue to run in / or the directory   //! dictadet by modifiers.
pike.git/lib/modules/Process.pmod:1176:   {    array(Stdio.File) opened = ({});    Stdio.File getfd(string|object f)    {    if (stringp(f))    {    Stdio.File ret = Stdio.File(f, "crw");    opened += ({ ret });    return ret;    } -  else +  else if (objectp(f))    return f; -  +  else +  return 0;    };    -  low_daemon(nochdir, noclose); -  if (undefinedp(modifiers)) +  if (low_daemon(nochdir, noclose) == -1) +  error("Failed to daemonize: " + strerror(errno())+"\n"); +  if (!modifiers)    return;       if (modifiers["cwd"])    cd(modifiers["cwd"]);       if (modifiers["stdin"])    getfd(modifiers["stdin"])->dup2(Stdio.stdin);       if (modifiers["stdout"])    getfd(modifiers["stdout"])->dup2(Stdio.stdout);       if (modifiers["stderr"])    getfd(modifiers["stderr"])->dup2(Stdio.stderr);       opened->close();   }