pike.git / lib / modules / Process.pmod

version» Context lines:

pike.git/lib/modules/Process.pmod:1:   #pike __REAL_VERSION__      #define error(X) throw( ({ (X), backtrace()[0..sizeof(backtrace())-2] }) )      import Stdio;      #if !constant(strerror)   #define strerror(X) ("errno="+X)   #endif    - program create_process = __builtin.create_process; + constant create_process = __builtin.create_process;    -  + class Process + { +  inherit __builtin.create_process; +  +  void create( string|array(string) args, mapping m ) +  { +  if( stringp( args ) ) +  args = split_quoted_string( args ); +  if( m ) +  ::create( args, m ); +  else +  ::create( args ); +  } + } +    int exec(string file,string ... foo)   {    if (sizeof(file)) {    string path;       if(search(file,"/") >= 0)    return exece(combine_path(getcwd(),file),foo,getenv());       path=getenv("PATH");   
pike.git/lib/modules/Process.pmod:130:    break;       default:    ret[-1]+="\0"+x[e];    break;    }    }    return ret;   }    - object spawn(string s,object|void stdin,object|void stdout,object|void stderr, + Process spawn(string s,object|void stdin,object|void stdout,object|void stderr,    function|void cleanup, mixed ... args)   {   #if 1    mapping data=(["env":getenv()]);    if(stdin) data->stdin=stdin;    if(stdout) data->stdout=stdout;    if(stderr) data->stderr=stderr;   #if defined(__NT__) || defined(__amigaos__)    return create_process(split_quoted_string(s),data);   #else /* !__NT__||__amigaos__ */    return create_process(({ "/bin/sh", "-c", s }),data);   #endif /* __NT__||__amigaos__ */   #else    -  object pid; +  Process pid;      #if constant(fork)    pid=fork();   #endif       if(pid)    {    return pid;    }else{    if(stdin ) stdin ->dup2(File("stdin"));