Skip to content

Commit b8818c4

Browse files
zygzagZrafaelfranca
authored andcommitted
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 #676.
1 parent af6440b commit b8818c4

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
@@ -377,10 +377,10 @@ def wait(pid, streams, client)
377377
Spring.failsafe_thread {
378378
begin
379379
_, status = Process.wait2 pid
380-
log "#{pid} exited with #{status.exitstatus}"
380+
log "#{pid} exited with #{status.exitstatus || status.inspect}"
381381

382382
streams.each(&:close)
383-
client.puts(status.exitstatus)
383+
client.puts(status.exitstatus || status.to_i)
384384
client.close
385385
ensure
386386
@mutex.synchronize { @waiting.delete pid }

0 commit comments

Comments
 (0)