8000 minor #51207 [Process] Fix test case (nicolas-grekas) · Wink-dev/symfony@a918ea5 · GitHub
[go: up one dir, main page]

Skip to content

Commit a918ea5

Browse files
minor symfony#51207 [Process] Fix test case (nicolas-grekas)
This PR was merged into the 5.4 branch. Discussion ---------- [Process] Fix test case | Q | A | ------------- | --- | Branch? | 5.4 | Bug fix? | no | New feature? | no | Deprecations? | no | Tickets | Fix symfony#48486 | License | MIT | Doc PR | - Commits ------- 05b5648 [Process] Fix test case
2 parents f299846 + 05b5648 commit a918ea5

File tree

2 files changed

+6
-2
lines changed

2 files changed

+6
-2
lines changed

src/Symfony/Component/Process/Tests/ErrorProcessInitiator.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,12 +14,12 @@
1414
use Symfony\Component\Process\Exception\ProcessTimedOutException;
1515
use Symfony\Component\Process\Process;
1616

17-
require \dirname(__DIR__).'/vendor/autoload.php';
17+
require is_file(\dirname(__DIR__).'/vendor/autoload.php') ? \dirname(__DIR__).'/vendor/autoload.php' : \dirname(__DIR__, 5).'/vendor/autoload.php';
1818

1919
['e' => $php] = getopt('e:') + ['e' => 'php'];
2020

2121
try {
22-
$process = new Process("exec $php -r \"echo 'ready'; trigger_error('error', E_USER_ERROR);\"");
22+
$process = new Process([$php, '-r', "echo 'ready'; trigger_error('error', E_USER_ERROR);"]);
2323
$process->start();
2424
$process->setTimeout(0.5);
2525
while (!str_contains($process->getOutput(), 'ready')) {

src/Symfony/Component/Process/Tests/ProcessTest.php

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1523,6 +1523,10 @@ public function testWaitStoppedDeadProcess()
15231523
$process->setTimeout(2);
15241524
$process->wait();
15251525
$this->assertFalse($process->isRunning());
1526+
1527+
if ('\\' !== \DIRECTORY_SEPARATOR) {
1528+
$this->assertSame(0, $process->getExitCode());
1529+
}
15261530
}
15271531

15281532
public function testEnvCaseInsensitiveOnWindows()

0 commit comments

Comments
 (0)
0