|author||Eric Wong <firstname.lastname@example.org>||2015-05-20 22:15:48 +0000|
|committer||Eric Wong <email@example.com>||2015-05-20 23:07:14 +0000|
Some process managers such as foreman and daemontools rely on unicorn not 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. Reported-by: Dan Moore <firstname.lastname@example.org> References: <etPan.555b4293.5b47a5b7.e617@danbookpro> <20150519232858.GA23515@dcvr.yhbt.net>
1 files changed, 3 insertions, 3 deletions
diff --git a/lib/unicorn/http_server.rb b/lib/unicorn/http_server.rb
index 82747b8..cf8e122 100644
@@ -294,13 +294,13 @@ class Unicorn::HttpServer
when :USR2 # exec binary, stay alive in case something went wrong
- if Unicorn::Configurator::RACKUP[:daemonized]
+ if $stdin.tty?
+ logger.info "SIGWINCH ignored because we're not daemonized"
respawn = false
logger.info "gracefully stopping all workers"
self.worker_processes = 0
- logger.info "SIGWINCH ignored because we're not daemonized"
respawn = true