diff --git a/.github/workflows/e2e.yaml b/.github/workflows/e2e.yaml index 5e20191d85b..a9b0cf25e46 100644 --- a/.github/workflows/e2e.yaml +++ b/.github/workflows/e2e.yaml @@ -32,6 +32,7 @@ jobs: - 'e2e/template-extends' - 'e2e/use-rector-configurator' - 'e2e/applied-rule-removed-node' + - 'e2e/parallel with space' name: End to end test - ${{ matrix.directory }} diff --git a/e2e/parallel with space/composer.json b/e2e/parallel with space/composer.json new file mode 100644 index 00000000000..8b5ca727be7 --- /dev/null +++ b/e2e/parallel with space/composer.json @@ -0,0 +1,5 @@ +{ + "require": { + "php": "^8.1" + } +} diff --git a/e2e/parallel with space/rector.php b/e2e/parallel with space/rector.php new file mode 100644 index 00000000000..9974d13c138 --- /dev/null +++ b/e2e/parallel with space/rector.php @@ -0,0 +1,12 @@ +paths([ + __DIR__ . '/src', + ]); + $rectorConfig->parallel(); +}; diff --git a/e2e/parallel with space/src/Test.php b/e2e/parallel with space/src/Test.php new file mode 100644 index 00000000000..09037ce3e74 --- /dev/null +++ b/e2e/parallel with space/src/Test.php @@ -0,0 +1,5 @@ +hasOption(Option::CONFIG)) { $workerCommandArray[] = '--config'; - $workerCommandArray[] = $input->getOption(Option::CONFIG); + /** + * On parallel, the command is generated with `--config` addition + * Using escapeshellarg() to ensure the --config path escaped, even when it has a space. + * + * eg: + * --config /path/e2e/parallel with space/rector.php + * + * that can cause error: + * + * File /rector-src/e2e/parallel\" was not found + * + * the escaped result is: + * + * --config '/path/e2e/parallel with space/rector.php' + * + * tested in macOS and Ubuntu (github action) + */ + $workerCommandArray[] = escapeshellarg($input->getOption(Option::CONFIG)); } return implode(' ', $workerCommandArray);