mirror of
https://github.com/deployphp/deployer.git
synced 2025-02-24 01:02:24 +01:00
More Symfony 5 compatibility fixes (#1971)
* Make Rsync compatible with symfony/process v5 * Make Ssh client compatible with symfony/process v5 * Add CHANGELOG entry
This commit is contained in:
parent
97c63e91cc
commit
5f32216c11
@ -6,6 +6,7 @@
|
||||
|
||||
### Fixed
|
||||
- Fixed compatibility with Symfony 4.x
|
||||
- Fixed more incompatibilities with Symfony 5
|
||||
|
||||
|
||||
## v6.7.1
|
||||
|
@ -68,7 +68,7 @@ class Client
|
||||
$command = escapeshellarg($command);
|
||||
|
||||
$ssh = "ssh $sshArguments $host $command";
|
||||
$process = new Process($ssh);
|
||||
$process = $this->createProcess($ssh);
|
||||
$process
|
||||
->setTimeout($config['timeout'])
|
||||
->setTty(true)
|
||||
@ -89,7 +89,7 @@ class Client
|
||||
$ssh = "ssh $sshArguments $host $become '$shellCommand; printf \"[exit_code:%s]\" $?;'";
|
||||
}
|
||||
|
||||
$process = new Process($ssh);
|
||||
$process = $this->createProcess($ssh);
|
||||
$process
|
||||
->setInput($command)
|
||||
->setTimeout($config['timeout']);
|
||||
@ -146,7 +146,7 @@ class Client
|
||||
|
||||
private function isMultiplexingInitialized(Host $host, Arguments $sshArguments)
|
||||
{
|
||||
$process = new Process("ssh -O check $sshArguments $host 2>&1");
|
||||
$process = $this->createProcess("ssh -O check $sshArguments $host 2>&1");
|
||||
$process->run();
|
||||
return (bool)preg_match('/Master running/', $process->getOutput());
|
||||
}
|
||||
@ -174,4 +174,13 @@ class Client
|
||||
}
|
||||
return $output;
|
||||
}
|
||||
|
||||
private function createProcess($command)
|
||||
{
|
||||
if (method_exists('Symfony\Component\Process\Process', 'fromShellCommandline')) {
|
||||
return Process::fromShellCommandline($command);
|
||||
} else {
|
||||
return new Process($command);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -43,7 +43,11 @@ class Rsync
|
||||
|
||||
$this->pop->command($hostname, $rsync);
|
||||
|
||||
$process = new Process($rsync);
|
||||
if (method_exists('Symfony\Component\Process\Process', 'fromShellCommandline')) {
|
||||
$process = Process::fromShellCommandline($rsync);
|
||||
} else {
|
||||
$process = new Process($rsync);
|
||||
}
|
||||
$process
|
||||
->setTimeout($config['timeout'])
|
||||
->mustRun($this->pop->callback($hostname));
|
||||
|
Loading…
x
Reference in New Issue
Block a user