pike.git / lib / modules / Process.pmod

version» Context lines:

pike.git/lib/modules/Process.pmod:400: Inside #if constant(kill)
  #if constant(kill)    ::kill(signum("SIGKILL"));   #endif    if(timeout_cb) timeout_cb(this);    }   }      // FIXME: Should probably be located elsewhere.   string locate_binary(array(string) path, string name)   { -  string dir; -  Stdio.Stat info; -  foreach(path, dir) -  { +    #ifdef __NT__ - #define PATH_SEPARATOR "\\" - #define EXECUTABLE_EXTENSION ".EXE" -  // Windows doesn't seem to strip quotation marks from PATH components that contain them -  // so we need to do that here, otherwise we'll end up with a bogus path to stat on. -  foreach(path;int i; string pc) +  if( !has_suffix(lower_case(name), ".exe") ) +  name += ".exe"; + #endif +  +  foreach(path, string dir)    { -  if(pc[0] == '"' && pc[-1] == '"') -  path[i] = pc[1..sizeof(pc)-2]; -  } - #else - #define PATH_SEPARATOR "/" - #define EXECUTABLE_EXTENSION "" + #ifdef __NT__ +  // Windows doesn't seem to strip quotation marks from PATH +  // components that contain them so we need to do that here, +  // otherwise we'll end up with a bogus path to stat on. +  if(sizeof(dir) && dir[0] == '"' && dir[-1] == '"') +  dir = dir[1..<1];   #endif /* __NT__ */    -  string fname = dir + PATH_SEPARATOR + name + EXECUTABLE_EXTENSION; -  if ((info = file_stat(fname)) -  && (info[0] & 0111)) +  string fname = combine_path(dir, name); +  Stdio.Stat info = file_stat(fname); +  if (info && (info->mode & 0111))    return fname;    }    return 0;   }      protected array(string) runpike;      //! Spawn a new pike process similar to the current.   //!   //! @param argv