[Process] Removed dead code in the start method
This commit is contained in:
parent
7d85ff27bd
commit
1eee2a461c
@ -268,26 +268,21 @@ class Process implements \IteratorAggregate
|
||||
}
|
||||
}
|
||||
|
||||
if (null === $env) {
|
||||
$env = $this->env;
|
||||
} elseif ($this->env) {
|
||||
if ($this->env) {
|
||||
$env += $this->env;
|
||||
}
|
||||
|
||||
$envBackup = array();
|
||||
if (null !== $env) {
|
||||
foreach ($env as $k => $v) {
|
||||
$envBackup[$k] = getenv($k);
|
||||
putenv(false === $v || null === $v ? $k : "$k=$v");
|
||||
}
|
||||
$env = null;
|
||||
}
|
||||
|
||||
$options = array('suppress_errors' => true);
|
||||
|
||||
if ('\\' === DIRECTORY_SEPARATOR) {
|
||||
$options['bypass_shell'] = true;
|
||||
$commandline = $this->prepareWindowsCommandLine($commandline, $envBackup, $env);
|
||||
$commandline = $this->prepareWindowsCommandLine($commandline, $envBackup);
|
||||
} elseif (!$this->useFileHandles && $this->isSigchildEnabled()) {
|
||||
// last exit code is output on the fourth pipe and caught to work around --enable-sigchild
|
||||
$descriptors[3] = array('pipe', 'w');
|
||||
@ -301,7 +296,7 @@ class Process implements \IteratorAggregate
|
||||
$ptsWorkaround = fopen(__FILE__, 'r');
|
||||
}
|
||||
|
||||
$this->process = proc_open($commandline, $descriptors, $this->processPipes->pipes, $this->cwd, $env, $options);
|
||||
$this->process = proc_open($commandline, $descriptors, $this->processPipes->pipes, $this->cwd, null, $options);
|
||||
|
||||
foreach ($envBackup as $k => $v) {
|
||||
putenv(false === $v ? $k : "$k=$v");
|
||||
@ -1464,7 +1459,7 @@ class Process implements \IteratorAggregate
|
||||
return true;
|
||||
}
|
||||
|
||||
private function prepareWindowsCommandLine($cmd, array &$envBackup, array &$env = null)
|
||||
private function prepareWindowsCommandLine($cmd, array &$envBackup)
|
||||
{
|
||||
$uid = uniqid('', true);
|
||||
$varCount = 0;
|
||||
@ -1477,7 +1472,7 @@ class Process implements \IteratorAggregate
|
||||
[^"%!^]*+
|
||||
)++
|
||||
) | [^"]*+ )"/x',
|
||||
function ($m) use (&$envBackup, &$env, &$varCache, &$varCount, $uid) {
|
||||
function ($m) use (&$envBackup, &$varCache, &$varCount, $uid) {
|
||||
if (!isset($m[1])) {
|
||||
return $m[0];
|
||||
}
|
||||
@ -1495,11 +1490,7 @@ class Process implements \IteratorAggregate
|
||||
$value = '"'.preg_replace('/(\\\\*)"/', '$1$1\\"', $value).'"';
|
||||
$var = $uid.++$varCount;
|
||||
|
||||
if (null === $env) {
|
||||
putenv("$var=$value");
|
||||
} else {
|
||||
$env[$var] = $value;
|
||||
}
|
||||
|
||||
$envBackup[$var] = false;
|
||||
|
||||
|
Reference in New Issue
Block a user