[Process] Always escape commands properly and remove windows-specific handling

This commit is contained in:
Jordi Boggiano 2012-02-16 16:46:57 +01:00
parent 9e237f6345
commit c4e8ff75f5

View File

@ -102,20 +102,12 @@ class ProcessBuilder
$options = $this->options;
if (defined('PHP_WINDOWS_VERSION_MAJOR')) {
$options['bypass_shell'] = true;
$arguments = $this->arguments;
$command = array_shift($arguments);
$arguments = $this->arguments;
$command = array_shift($arguments);
$script = '"'.$command.'"';
if ($arguments) {
$script .= ' '.implode(' ', array_map('escapeshellarg', $arguments));
}
$script = 'cmd /V:ON /E:ON /C "'.$script.'"';
} else {
$script = implode(' ', array_map('escapeshellarg', $this->arguments));
$script = escapeshellcmd($command);
if ($arguments) {
$script .= ' '.implode(' ', array_map('escapeshellarg', $arguments));
}
$env = $this->inheritEnv && $_ENV ? $this->env + $_ENV : $this->env;