pike.git / lib / modules / Process.pmod

version» Context lines:

pike.git/lib/modules/Process.pmod:431:   }      protected array(string) runpike;      //! Spawn a new pike process similar to the current.   //!   //! @param argv   //! Arguments for the new process.   //!   //! @param options - //! Process creation options. See @[Process.Process] for details. + //! Process creation options. See @[Process.Process] for details. May also + //! specify "add_predefines", "add_program_path", or "add_include_path" in + //! order to include these components in command path (module path is + //! included by default.)   //!   //! @seealso   //! @[Process.Process]   Process spawn_pike(array(string) argv, void|mapping(string:mixed) options)   {    if (!runpike) {    array(string) res = ({    master()->_pike_file_name,    });    if (master()->_master_file_name)    res+=({"-m"+master()->_master_file_name});    foreach (master()->pike_module_path;;string path) -  res+=({"-M"+path}); +  res+=({"-M" + path}); +  if(options->add_predefines) +  { +  foreach (master()->predefines; string key; string value) +  res+=({"-D" + key + "=" + value}); +  } +  if(options->add_program_path) +  { +  foreach (master()->pike_program_path; string key; string value) +  res+=({"-P" + key + "=" + value}); +  } +  if(options->add_include_path) +  { +  foreach (master()->pike_include_path; string key; string value) +  res+=({"-P" + key + "=" + value}); +  }    -  // FIXME: Defines? pike_program_path? -  +     if (sizeof(res) && !has_value(res[0],"/")   #ifdef __NT__    && !has_value(res[0], "\\")   #endif /* __NT__ */    )    res[0] = locate_binary(getenv("PATH")/   #if defined(__NT__) || defined(__amigaos__)    ";"   #else    ":"
pike.git/lib/modules/Process.pmod:648:    array(string) e=(getenv("PATH")||"")/":"-({""});   #endif       multiset(string) filter=(<>);    search_path_entries=({});    foreach (e,string s)    {    string t;    if (s[0]=='~') // some shells allow ~-expansion in PATH    { -  if (s[0..1]=="~/" && (t=[string]getenv("HOME"))) +  if (s[0..1]=="~/" && (t=System.get_home()))    s=t+s[1..];    else    {    // expand user?    }    }    if (!filter[s] /* && directory exist */ )    {    search_path_entries+=({s});    filter[s]=1;