Navigation Menu

Skip to content

Commit

Permalink
child exits falsey if an exception occurred
Browse files Browse the repository at this point in the history
  • Loading branch information
rtomayko committed Jun 22, 2010
1 parent d4c538c commit 5ffbda8
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions lib/shotgun.rb
Expand Up @@ -76,16 +76,21 @@ def format_error(error, backtrace)
# Stuff that happens in the child process

def proceed_as_child
boom = false
@reader.close
app = assemble_app
status, headers, body = app.call(@env)
Marshal.dump([:ok, status, headers.to_hash], @writer)
spec_body(body).each { |chunk| @writer.write(chunk) }
rescue Object => boom
Marshal.dump(["#{boom.class.name}: #{boom.to_s}", boom.backtrace], @writer)
Marshal.dump([
:error,
"#{boom.class.name}: #{boom.to_s}",
boom.backtrace
], @writer)
ensure
@writer.close
exit! 0
exit! boom ? 1 : 0
end

def assemble_app
Expand Down

0 comments on commit 5ffbda8

Please sign in to comment.