Skip to content

Commit 3a8e609

Browse files
committed
Pass signaled exit code properly to the client
Process::Status#existstatus is nil when child did not exit cleanly. When ruby process crashes, running it with spring masked exit code and returned 0. This commit allows Spring::Server thread to properly pass application exit code to child, even when signaled or stopped. Fixes rails#676.
1 parent 046d50a commit 3a8e609

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

lib/spring/application.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -370,10 +370,10 @@ def wait(pid, streams, client)
370370
Spring.failsafe_thread {
371371
begin
372372
_, status = Process.wait2 pid
373-
log "#{pid} exited with #{status.exitstatus}"
373+
log "#{pid} exited with #{status.exitstatus || status.inspect}"
374374

375375
streams.each(&:close)
376-
client.puts(status.exitstatus)
376+
client.puts(status.exitstatus || status.to_i)
377377
client.close
378378
ensure
379379
@mutex.synchronize { @waiting.delete pid }

0 commit comments

Comments
 (0)