Handle signal-terminated processes in exit status#1027
Merged
grosser merged 1 commit intogrosser:masterfrom Feb 5, 2026
Merged
Conversation
When a child process is terminated by a Unix signal (e.g., SIGKILL, SIGTERM), $?.exitstatus returns nil. This caused downstream code to break when comparing exit statuses. Following Unix shell convention, signal terminations now return 128 + signal_number (e.g., 137 for SIGKILL, 143 for SIGTERM). Falls back to exit status 1 if neither exitstatus nor termsig is available.
edcd803 to
874daeb
Compare
Owner
|
5.6.0 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
When a child process is terminated by a Unix signal (e.g., SIGKILL, SIGTERM),
$?.exitstatusreturnsnilwhile$?.termsigcontains the signal number. This causes downstream code to fail when comparing or aggregating exit statuses.Affected code paths
The following code in
cli.rbbreaks whenexit_statusisnil:cli.rb:102---highest-exit-statusoption:cli.rb:120---test-file-limitoption:Both fail with
ArgumentError: comparison of Integer with nil failedwhen a test process is killed by a signal.Solution
In
execute_command_and_capture_output, ensureexit_statusis always an integer:$?.exitstatusfor normal process termination$?.termsig + 128for signal termination (following Unix shell convention)1as a defensive defaultThe 128 + signal convention is standard in Unix shells (e.g., bash returns 137 for SIGKILL, 143 for SIGTERM).
Changes
lib/parallel_tests/test/runner.rb: Handle nil exitstatus from signal-terminated processesspec/parallel_tests/test/runner_spec.rb: Add spec for signal termination behavior