Branch: Tag:

2002-08-09

2002-08-09 14:23:45 by Martin Nilsson <mani@lysator.liu.se>

Added some autodoc markers and removed dead code.

Rev: lib/modules/Process.pmod:1.35

1:   #pike __REAL_VERSION__    - import Stdio; -  - #if !constant(strerror) - #define strerror(X) ("errno="+X) - #endif -  +    constant create_process = __builtin.create_process;    -  + //!   class Process   {    inherit __builtin.create_process;    -  +  //!    void create( string|array(string) args, mapping m )    {    if( stringp( args ) )
23:    }   }    + //!   int exec(string file,string ... foo)   {    if (sizeof(file)) {
41:   }      static array(string) search_path_entries=0; +  + //!   string search_path(string command)   {    if (command=="" || command[0]=='/') return command;
79:    return 0;   }    + //!   string sh_quote(string s)   {    return replace(s,
86:    ({"\\\\", "\\'", "\\\"","\\ "}));   }    + //!   array(string) split_quoted_string(string s)   {    sscanf(s,"%*[ \n\t]%s",s);
150:    return ret;   }    + //!   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;
169:   #else /* !__NT__||__amigaos__ */    return create_process(({ "/bin/sh", "-c", s }),data);   #endif /* __NT__||__amigaos__ */ - #else +     -  Process pid; -  - #if constant(fork) -  pid=fork(); - #endif -  -  if(pid) -  { -  return pid; -  }else{ -  if(stdin ) stdin ->dup2(File("stdin")); -  if(stdout) stdout->dup2(File("stdout")); -  if(stderr) stderr->dup2(File("stderr")); -  -  if(stdin ) destruct(stdin); -  if(stdout) destruct(stdout); -  if(stderr) destruct(stderr); -  -  if (cleanup) { -  cleanup(@args); +    }    -  exec("/bin/sh","-c",s); -  exit(69); -  } - #endif - } -  + //!   string popen(string s)   {    object p;    string t; -  object f = File(); +  object f = Stdio.File();       if (!f) error("Popen failed. (couldn't create pipe)\n");   
228:    return t;   }    + //!   int system(string s)   {    return spawn(s)->wait();
243: Inside #if undefined(__NT__)
  #endif      #if constant(fork) +  + //!   class Spawn   {    object stdin;