mirror of https://github.com/rectorphp/rector.git
[e2e] Add e2e for parallel process with current directory contains space (#2421)
* [e2e] Add e2e for parallel process with current directory contains space
* [e2e] Add e2e for parallel process with current directory contains space
* dir name
* Fixed 🎉
* phpstan
* final touch: eol
* clean up
* clean up
* final touch: use escapeshellarg()
* Add note for why escapeshellarg() is needed in parallel
This commit is contained in:
parent
d2bf080d6b
commit
e8f058a6e4
|
@ -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 }}
|
||||
|
||||
|
|
|
@ -0,0 +1,5 @@
|
|||
{
|
||||
"require": {
|
||||
"php": "^8.1"
|
||||
}
|
||||
}
|
|
@ -0,0 +1,12 @@
|
|||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
use Rector\Config\RectorConfig;
|
||||
|
||||
return static function (RectorConfig $rectorConfig): void {
|
||||
$rectorConfig->paths([
|
||||
__DIR__ . '/src',
|
||||
]);
|
||||
$rectorConfig->parallel();
|
||||
};
|
|
@ -0,0 +1,5 @@
|
|||
<?php
|
||||
|
||||
class Test
|
||||
{
|
||||
}
|
|
@ -93,7 +93,24 @@ final class WorkerCommandLineFactory
|
|||
|
||||
if ($input->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);
|
||||
|
|
Loading…
Reference in New Issue