Add checks for fromShellCommandline method

This commit is contained in:
Anton Medvedev 2019-12-15 21:51:28 +07:00
parent f968f366bc
commit d9c744808e
3 changed files with 12 additions and 3 deletions

View File

@ -171,7 +171,11 @@ class ParallelExecutor implements ExecutorInterface
}
$command = "$dep $file worker $arguments $options --hostname $hostname --task $taskName --config-file $configFile";
$process = Process::fromShellCommandline($command);
if (method_exists('Symfony\Component\Process\Process', 'fromShellCommandline')) {
$process = Process::fromShellCommandline($command);
} else {
$process = new Process($command);
}
if (!defined('DEPLOYER_PARALLEL_PTY')) {
$process->setPty(true);

View File

@ -44,11 +44,12 @@ class ProcessRunner
$this->pop->command($hostname, $command);
if (method_exists('Process', 'fromShellCommandline')) {
if (method_exists('Symfony\Component\Process\Process', 'fromShellCommandline')) {
$process = Process::fromShellCommandline($command);
} else {
$process = new Process($command);
}
$process
->setTimeout($config['timeout'])
->setTty($config['tty'])

View File

@ -21,7 +21,11 @@ function exec($command)
$command = 'cd ' . DepCase::$currentPath . ' && ' . $command;
}
$process = Process::fromShellCommandline($command);
if (method_exists('Symfony\Component\Process\Process', 'fromShellCommandline')) {
$process = Process::fromShellCommandline($command);
} else {
$process = new Process($command);
}
$process
->mustRun();