diff --git a/src/RemoteProcessor.php b/src/RemoteProcessor.php index 27fe0585..5c889212 100644 --- a/src/RemoteProcessor.php +++ b/src/RemoteProcessor.php @@ -30,7 +30,7 @@ protected function getProcess($host, Task $task) $env = $this->getEnvironment($host); if (in_array($target, ['local', 'localhost', '127.0.0.1'])) { - $process = new Process(explode(' ', $task->script), null, $env); + $process = Process::fromShellCommandline($task->script, null, $env); } // Here we'll run the SSH task on the server inline. We do not need to write the @@ -46,7 +46,7 @@ protected function getProcess($host, Task $task) } if (strtoupper(substr(PHP_OS, 0, 3)) === 'WIN') { - $process = new Process(['ssh', $target, '-T']); + $process = Process::fromShellCommandline("ssh $target -T"); $process->setInput( implode(PHP_EOL, $env) @@ -54,17 +54,13 @@ protected function getProcess($host, Task $task) .str_replace("\r", '', $task->script) ); } else { - $process = new Process([ - 'ssh', - $target, - 'bash', - '-se', - "<< \\$delimiter".PHP_EOL + $process = Process::fromShellCommandline( + "ssh $target 'bash -se' << \\$delimiter".PHP_EOL .implode(PHP_EOL, $env).PHP_EOL .'set -e'.PHP_EOL .$task->script.PHP_EOL - .$delimiter, - ]); + .$delimiter + ); } }