Prevent silencing ExitFailure in ProcessContext->join() (#207)
Some checks failed
Continuous Integration / PHP ${{ matrix.php-version }} ${{ matrix.job-description }} (false, on Windows, windows-latest, nts, 8.3) (push) Has been cancelled
Continuous Integration / PHP ${{ matrix.php-version }} ${{ matrix.job-description }} (false, on macOS, macos-latest, nts, 8.3) (push) Has been cancelled
Continuous Integration / PHP ${{ matrix.php-version }} ${{ matrix.job-description }} (false, ubuntu-latest, nts, 8.1) (push) Has been cancelled
Continuous Integration / PHP ${{ matrix.php-version }} ${{ matrix.job-description }} (false, ubuntu-latest, nts, 8.2) (push) Has been cancelled
Continuous Integration / PHP ${{ matrix.php-version }} ${{ matrix.job-description }} (false, ubuntu-latest, nts, 8.3) (push) Has been cancelled
Continuous Integration / PHP ${{ matrix.php-version }} ${{ matrix.job-description }} (none, true, with ext-parallel, ubuntu-latest, parallel, ts, 8.2, none, none) (push) Has been cancelled
Continuous Integration / PHP ${{ matrix.php-version }} ${{ matrix.job-description }} (none, true, with ext-parallel, ubuntu-latest, parallel, ts, 8.3, none, none) (push) Has been cancelled

This commit is contained in:
Bob Weinand 2024-12-21 02:56:09 +01:00 committed by GitHub
parent 9777db1460
commit 5113111de0
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -281,11 +281,16 @@ final class ProcessContext extends AbstractContext
$data = $this->receiveExitResult($cancellation);
$code = $this->process->join();
if ($code !== 0) {
throw new ContextException(\sprintf("Context exited with code %d", $code));
}
return $data->getResult();
try {
return $data->getResult();
} finally {
if ($code !== 0) {
// If an ExitFailure throws above, the exception will be automatically attached as the previous
// exception on the instance thrown below.
throw new ContextException(\sprintf("Context exited with code %d", $code));
}
}
}
/**