Skip to content

Commit 6bedfad

Browse files
zygzagZrafaelfranca
authored andcommitted
Expect exit status code in spring client
In the previous commit I fixed a scenario where Spring Server failed to pass the application exit code through to Spring Client. Should similar thing happen in future, this can also be detected in Spring Client. It should expect to read some integer and not default to 0 when read nil. This commit introduces such assertion in Spring Client. Also fixes #676. @see 3a8e609
1 parent b8818c4 commit 6bedfad

File tree

1 file changed

+8
-3
lines changed

1 file changed

+8
-3
lines changed

lib/spring/client/run.rb

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -184,11 +184,16 @@ def run_command(client, application)
184184
suspend_resume_on_tstp_cont(pid)
185185

186186
forward_signals(application)
187-
status = application.read.to_i
187+
status = application.read
188+
log "got exit status #{status.inspect}"
188189

189-
log "got exit status #{status}"
190+
# Status should always be an integer. If it is empty, something unexpected must have happened to the server.
191+
if status.to_s.strip.empty?
192+
log "unexpected empty exit status, app crashed?"
193+
exit 1
194+
end
190195

191-
exit status
196+
exit status.to_i
192197
else
193198
log "got no pid"
194199
exit 1

0 commit comments

Comments
 (0)