X-Git-Url: https://git.openstreetmap.org./nominatim.git/blobdiff_plain/62747c934d3445b000810f8a7737ea86777995e3..1108bf7d8679b85b7aa9f829019acf4dc8210dd3:/lib/cmd.php diff --git a/lib/cmd.php b/lib/cmd.php index 8ccbb036..2fd3c49b 100644 --- a/lib/cmd.php +++ b/lib/cmd.php @@ -196,3 +196,21 @@ function runSQLScript($sScript, $bfatal = true, $bVerbose = false, $bIgnoreError fail("pgsql returned with error code ($iReturn)"); } } + + +function runWithEnv($cmd, $env) +{ + $fds = array(0 => array('pipe', 'r'), + 1 => STDOUT, + 2 => STDERR); + $pipes = null; + $proc = @proc_open($cmd, $fds, $pipes, null, $env); + if (!is_resource($proc)) { + fail('unable to run command:' . $cmd); + } + + fclose($pipes[0]); // no stdin + + $stat = proc_close($proc); + return $stat; +}