Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Setup signal to trap SIGINT and gracefully stop server #1377

Merged
merged 1 commit into from Aug 16, 2017
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
22 changes: 14 additions & 8 deletions lib/puma/launcher.rb
Expand Up @@ -398,6 +398,20 @@ def setup_signals
log "*** SIGTERM not implemented, signal based gracefully stopping unavailable!"
end

begin
Signal.trap "SIGINT" do
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

code lower in this file

if Puma.jruby?
  Signal.trap("INT") do

move those two together

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fixed

if Puma.jruby?
@status = :exit
graceful_stop
exit
end

stop
end
rescue Exception
log "*** SIGINT not implemented, signal based gracefully stopping unavailable!"
end

begin
Signal.trap "SIGHUP" do
if @runner.redirected_io?
Expand All @@ -409,14 +423,6 @@ def setup_signals
rescue Exception
log "*** SIGHUP not implemented, signal based logs reopening unavailable!"
end

if Puma.jruby?
Signal.trap("INT") do
@status = :exit
graceful_stop
exit
end
end
end
end
end