Skip to content

Commit

Permalink
[Process] Fix test case
Browse files Browse the repository at this point in the history
  • Loading branch information
nicolas-grekas committed Aug 1, 2023
1 parent 1a44dc3 commit ce9850f
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
4 changes: 2 additions & 2 deletions Tests/ErrorProcessInitiator.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,12 +14,12 @@
use Symfony\Component\Process\Exception\ProcessTimedOutException;
use Symfony\Component\Process\Process;

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

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

try {
$process = new Process("exec $php -r \"echo 'ready'; trigger_error('error', E_USER_ERROR);\"");
$process = new Process([$php, '-r', "echo 'ready'; trigger_error('error', E_USER_ERROR);"]);
$process->start();
$process->setTimeout(0.5);
while (!str_contains($process->getOutput(), 'ready')) {
Expand Down
4 changes: 4 additions & 0 deletions Tests/ProcessTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -1523,6 +1523,10 @@ public function testWaitStoppedDeadProcess()
$process->setTimeout(2);
$process->wait();
$this->assertFalse($process->isRunning());

if ('\\' !== \DIRECTORY_SEPARATOR) {
$this->assertSame(0, $process->getExitCode());
}
}

public function testEnvCaseInsensitiveOnWindows()
Expand Down

0 comments on commit ce9850f

Please sign in to comment.