-
-
-function runWithEnv($sCmd, $aEnv)
-{
- $aFDs = array(
- 0 => array('pipe', 'r'),
- 1 => STDOUT,
- 2 => STDERR
- );
- $aPipes = null;
- $hProc = @proc_open($sCmd, $aFDs, $aPipes, null, $aEnv);
- if (!is_resource($hProc)) {
- fail('unable to run command:' . $sCmd);
- }
-
- fclose($aPipes[0]); // no stdin
-
- $iStat = proc_close($hProc);
- return $iStat;
-}