Issue #3162045 by andypost, ravi.shankar, catch, longwave: [Symfony 5] TypeError: Argument 1 passed to Symfony\Component\Process\Process::__construct() must be of the type array, string given

merge-requests/2/head
Alex Pott 2020-08-02 11:19:38 +01:00
parent 0c30b0d61a
commit 59b936d051
No known key found for this signature in database
GPG Key ID: 31905460D4A69276
4 changed files with 5 additions and 5 deletions

View File

@ -148,8 +148,8 @@ class ServerCommand extends Command {
$url = escapeshellarg($url);
}
$is_linux = (new Process('which xdg-open'))->run();
$is_osx = (new Process('which open'))->run();
$is_linux = Process::fromShellCommandline('which xdg-open')->run();
$is_osx = Process::fromShellCommandline('which open')->run();
if ($is_linux === 0) {
$cmd = 'xdg-open ' . $url;
}

View File

@ -311,7 +311,7 @@ abstract class BuildTestBase extends TestCase {
* @return \Symfony\Component\Process\Process
*/
public function executeCommand($command_line, $working_dir = NULL) {
$this->commandProcess = new Process($command_line);
$this->commandProcess = Process::fromShellCommandline($command_line);
$this->commandProcess->setWorkingDirectory($this->getWorkingPath($working_dir))
->setTimeout(300)
->setIdleTimeout(300);

View File

@ -23,7 +23,7 @@ trait ExecTrait {
* Standard output from the command
*/
protected function mustExec($cmd, $cwd, array $env = []) {
$process = new Process($cmd, $cwd, $env + ['PATH' => getenv('PATH'), 'HOME' => getenv('HOME')]);
$process = Process::fromShellCommandline($cmd, $cwd, $env + ['PATH' => getenv('PATH'), 'HOME' => getenv('HOME')]);
$process->setTimeout(300)->setIdleTimeout(300)->run();
$exitCode = $process->getExitCode();
if (0 != $exitCode) {

View File

@ -20,7 +20,7 @@ class PhpUnitCliTest extends UnitTestCase {
// duplicate namespace errors or so forth. This keeps us from committing
// tests which don't break under run-tests.sh, but do break under the
// phpunit test runner tool.
$process = new Process('vendor/bin/phpunit --configuration core --verbose --list-tests');
$process = Process::fromShellCommandline('vendor/bin/phpunit --configuration core --verbose --list-tests');
$process->setWorkingDirectory($this->root)
->setTimeout(300)
->setIdleTimeout(300);