diff --git a/lib/parallel_tests/test/runner.rb b/lib/parallel_tests/test/runner.rb index 5e8669e9..1b241e67 100644 --- a/lib/parallel_tests/test/runner.rb +++ b/lib/parallel_tests/test/runner.rb @@ -110,7 +110,16 @@ def execute_command_and_capture_output(env, cmd, options) capture_output(io, env, options) end ParallelTests.pids.delete(pid) if pid - exitstatus = $?.exitstatus + + status = $? + exitstatus = if status.exitstatus + status.exitstatus + elsif status.termsig + status.termsig + 128 + else + 1 + end + seed = output[/seed (\d+)/, 1] output = "#{Shellwords.shelljoin(cmd)}\n#{output}" if report_process_command?(options) && options[:serialize_stdout] diff --git a/spec/parallel_tests/test/runner_spec.rb b/spec/parallel_tests/test/runner_spec.rb index 571433dd..534e2f73 100644 --- a/spec/parallel_tests/test/runner_spec.rb +++ b/spec/parallel_tests/test/runner_spec.rb @@ -564,6 +564,13 @@ def run_with_file(content) end end + it "returns exit status 128 + signal number when terminated by signal", unless: Gem.win_platform? do + run_with_file("Process.kill('KILL', Process.pid)") do |path| + result = call(["ruby", path], 1, 4, {}) + expect(result[:exit_status]).to eq 128 + 9 # SIGKILL = 9 + end + end + it "prints each stream to the correct stream" do skip "open3" _out, err = run_with_file("puts 123 ; $stderr.puts 345 ; exit 5") do |path|