Restore bypass_shell by default with windows compat

This commit is contained in:
Jordi Boggiano 2012-02-22 14:19:04 +01:00
parent 38df47a459
commit 54cfd4410c
3 changed files with 9 additions and 6 deletions

View File

@ -116,7 +116,7 @@ class Process
}
$this->stdin = $stdin;
$this->timeout = $timeout;
$this->options = array_merge(array('suppress_errors' => true, 'binary_pipes' => true, 'bypass_shell' => false), $options);
$this->options = array_merge(array('suppress_errors' => true, 'binary_pipes' => true), $options);
}
/**
@ -164,6 +164,9 @@ class Process
if (defined('PHP_WINDOWS_VERSION_BUILD') && $this->enhanceWindowsCompatibility) {
$commandline = 'cmd /V:ON /E:ON /C "'.$commandline.'"';
if (!isset($this->options['bypass_shell'])) {
$this->options['bypass_shell'] = true;
}
}
$process = proc_open($commandline, $descriptors, $pipes, $this->cwd, $this->env, $this->options);

View File

@ -32,7 +32,7 @@ class ProcessBuilder
$this->timeout = 60;
$this->options = array();
$this->inheritEnv = false;
$this->inheritEnv = true;
}
public static function create(array $arguments = array())
@ -112,7 +112,7 @@ class ProcessBuilder
$env = null;
if ($this->inheritEnv) {
$env = $_ENV ? $this->env + $_ENV : $this->env;
$env = $this->env ? $this->env + $_ENV : null;
} else {
$env = $this->env;
}

View File

@ -27,7 +27,7 @@ class ProcessBuilderTest extends \PHPUnit_Framework_TestCase
$pb->add('foo')->inheritEnvironmentVariables();
$proc = $pb->getProcess();
$this->assertEquals($expected, $proc->getEnv(), '->inheritEnvironmentVariables() copies $_ENV');
$this->assertEquals(null, $proc->getEnv(), '->inheritEnvironmentVariables() copies $_ENV');
$_ENV = $snapshot;
}
@ -54,12 +54,12 @@ class ProcessBuilderTest extends \PHPUnit_Framework_TestCase
/**
* @test
*/
public function shouldNotInheritEnvironmentVarsByDefault()
public function shouldInheritEnvironmentVarsByDefault()
{
$pb = new ProcessBuilder();
$proc = $pb->add('foo')->getProcess();
$this->assertEquals(array(), $proc->getEnv());
$this->assertEquals(null, $proc->getEnv());
}
/**