1
0
Fork 0

Fix compat with Symfony Process 4.2, fixes #7923

pull/7925/head
Jordi Boggiano 2019-01-28 14:38:32 +01:00
parent c5cc178375
commit a9aaa25d4c
3 changed files with 20 additions and 3 deletions

View File

@ -557,7 +557,12 @@ EOT
$finder = new ExecutableFinder(); $finder = new ExecutableFinder();
$gitBin = $finder->find('git'); $gitBin = $finder->find('git');
// 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 = new Process(sprintf('%s config -l', ProcessExecutor::escape($gitBin)));
}
$cmd->run(); $cmd->run();
if ($cmd->isSuccessful()) { if ($cmd->isSuccessful()) {

View File

@ -370,7 +370,13 @@ class Perforce
public function windowsLogin($password) public function windowsLogin($password)
{ {
$command = $this->generateP4Command(' login -a'); $command = $this->generateP4Command(' login -a');
// 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); $process = new Process($command, null, null, $password);
}
return $process->run(); return $process->run();
} }

View File

@ -62,7 +62,13 @@ class ProcessExecutor
$this->captureOutput = func_num_args() > 1; $this->captureOutput = func_num_args() > 1;
$this->errorOutput = null; $this->errorOutput = null;
// 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()); $process = new Process($command, $cwd, null, null, static::getTimeout());
}
$callback = is_callable($output) ? $output : array($this, 'outputHandler'); $callback = is_callable($output) ? $output : array($this, 'outputHandler');
$process->run($callback); $process->run($callback);