diff --git a/src/Composer/Command/InitCommand.php b/src/Composer/Command/InitCommand.php index 02efbf686..abcea73b2 100644 --- a/src/Composer/Command/InitCommand.php +++ b/src/Composer/Command/InitCommand.php @@ -557,7 +557,12 @@ EOT $finder = new ExecutableFinder(); $gitBin = $finder->find('git'); - $cmd = new Process(sprintf('%s config -l', ProcessExecutor::escape($gitBin))); + // TODO in v3 always call with an array + if (method_exists('Symfony\Component\Process\Process', 'fromShellCommandline')) { + $cmd = new Process(array($gitBin, 'config', '-l')); + } else { + $cmd = new Process(sprintf('%s config -l', ProcessExecutor::escape($gitBin))); + } $cmd->run(); if ($cmd->isSuccessful()) { diff --git a/src/Composer/Util/Perforce.php b/src/Composer/Util/Perforce.php index b064feec4..31ddeffec 100644 --- a/src/Composer/Util/Perforce.php +++ b/src/Composer/Util/Perforce.php @@ -370,7 +370,13 @@ class Perforce public function windowsLogin($password) { $command = $this->generateP4Command(' login -a'); - $process = new Process($command, null, null, $password); + + // TODO in v3 generate command as an array + if (method_exists('Symfony\Component\Process\Process', 'fromShellCommandline')) { + $process = Process::fromShellCommandline($command, null, null, $password); + } else { + $process = new Process($command, null, null, $password); + } return $process->run(); } diff --git a/src/Composer/Util/ProcessExecutor.php b/src/Composer/Util/ProcessExecutor.php index 2a0742778..f5e1ef610 100644 --- a/src/Composer/Util/ProcessExecutor.php +++ b/src/Composer/Util/ProcessExecutor.php @@ -62,7 +62,13 @@ class ProcessExecutor $this->captureOutput = func_num_args() > 1; $this->errorOutput = null; - $process = new Process($command, $cwd, null, null, static::getTimeout()); + + // TODO in v3, commands should be passed in as arrays of cmd + args + if (method_exists('Symfony\Component\Process\Process', 'fromShellCommandline')) { + $process = Process::fromShellCommandline($command, $cwd, null, null, static::getTimeout()); + } else { + $process = new Process($command, $cwd, null, null, static::getTimeout()); + } $callback = is_callable($output) ? $output : array($this, 'outputHandler'); $process->run($callback);