Skip to content

Commit

Permalink
Merge pull request #69 from creasico/test/bs-local-output-issue
Browse files Browse the repository at this point in the history
Check recent ci fails
  • Loading branch information
feryardiant authored Aug 3, 2024
2 parents 87124fa + e29d7a7 commit d91f4b4
Showing 1 changed file with 7 additions and 17 deletions.
24 changes: 7 additions & 17 deletions src/LocalProcess.php
Original file line number Diff line number Diff line change
Expand Up @@ -45,25 +45,15 @@ public function start(): void

$this->process->start();

try {
$this->process->waitUntil(function ($_, $output): bool {
[$_, $message] = \explode('--', $output);
$this->process->waitUntil(function ($type, $output): bool {
$message = \explode(' -- ', trim($output))[1];

if (\str_contains($message, '[ERROR]')) {
throw new \RuntimeException(\explode('[ERROR] ', $message)[1]);
}

if (\str_contains($message, 'Error:')) {
throw new \RuntimeException(\explode('Error: ', $message)[1]);
}

return \str_contains($message, '[SUCCESS]');
});
} catch (\Throwable $e) {
$this->process->stop();
if ($type === Process::ERR) {
throw new \RuntimeException($message);
}

throw $e;
}
return \str_contains($message, '[SUCCESS]');
});

// We register the below, so if php is exited early, the child
// process for the server is closed down, rather than left
Expand Down

0 comments on commit d91f4b4

Please sign in to comment.