From 5b57f3cb9a9f7cb72a7f3d6352cb6a1ce7d52af1 Mon Sep 17 00:00:00 2001 From: Michael Grosser Date: Thu, 8 Mar 2018 19:13:26 -0800 Subject: [PATCH] allow app to also handle sighup and call super our app wants to reopen rails logs on sighup to do that it needs to trap sighup too but calling pumas trap after does not work since it crashes the server if redirect_io was not used with this change there is 1 less trap used and our app can only call pumas trap if it was set --- lib/puma/launcher.rb | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/lib/puma/launcher.rb b/lib/puma/launcher.rb index cbf477a934..865bc08cbb 100644 --- a/lib/puma/launcher.rb +++ b/lib/puma/launcher.rb @@ -414,16 +414,14 @@ def setup_signals log "*** SIGINT not implemented, signal based gracefully stopping unavailable!" end - begin - Signal.trap "SIGHUP" do - if @runner.redirected_io? + if @runner.redirected_io? + begin + Signal.trap "SIGHUP" do @runner.redirect_io - else - stop end + rescue Exception + log "*** SIGHUP not implemented, signal based logs reopening unavailable!" end - rescue Exception - log "*** SIGHUP not implemented, signal based logs reopening unavailable!" end end end