about summary refs log tree commit homepage
diff options
context:
space:
mode:
authorEric Wong <e@80x24.org>2015-06-05 08:57:45 +0000
committerEric Wong <e@80x24.org>2015-06-05 08:57:45 +0000
commit19e1bf7e56201a91e0e0ae7763e5153407392561 (patch)
tree4ac8c1220b620b8447053e016e5db9eeb0adfaf0
parentcc2db04b47c5b5daf73873f3865da715812408db (diff)
downloadyahns-19e1bf7e56201a91e0e0ae7763e5153407392561.tar.gz
This has no effect for the (default) single process case with
no master/worker relationship as that does not support SIGWINCH.

Some process managers such as foreman and daemontools rely on
yahnsnot daemonizing, but we still want to be able to process
SIGWINCH in that case.

stdout and stderr may be redirected to a pipe (for cronolog or
similar process), so those are less likely to be attached to a TTY
than stdin.  This also allows users to process SIGWINCH when running
inside a regular terminal if they redirect stdin to /dev/null.

This follows unicorn commit a6077391bb62d0b13016084b0eea36b987afe8f0
Thanks to Dan Moore for suggesting it on the unicorn list.
-rw-r--r--lib/yahns/server_mp.rb6
1 files changed, 3 insertions, 3 deletions
diff --git a/lib/yahns/server_mp.rb b/lib/yahns/server_mp.rb
index 2e9da20..9e6ec60 100644
--- a/lib/yahns/server_mp.rb
+++ b/lib/yahns/server_mp.rb
@@ -103,13 +103,13 @@ module Yahns::ServerMP # :nodoc:
       when :USR2 # exec binary, stay alive in case something went wrong
         reexec
       when :WINCH
-        if @daemon_pipe
+        if $stdin.tty?
+          @logger.info "SIGWINCH ignored because we're not daemonized"
+        else
           state = :WINCH
           @logger.info "gracefully stopping all workers"
           soft_kill_each_worker("QUIT")
           @worker_processes = 0
-        else
-          @logger.info "SIGWINCH ignored because we're not daemonized"
         end
       when :TTIN
         state = :respawn unless state == :QUIT