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