diff options
author | Eric Wong <normalperson@yhbt.net> | 2011-07-20 22:42:16 +0000 |
---|---|---|
committer | Eric Wong <normalperson@yhbt.net> | 2011-07-20 22:42:16 +0000 |
commit | 6d56d7ab891d2cb6127b4cba428a0f7c13b9d2ce (patch) | |
tree | 1f1f0d959904fa26df5b1b842692e2f4f4ef0feb /lib/unicorn | |
parent | 83f72773b7242d86263a18950fca7c8101d7038d (diff) | |
download | unicorn-6d56d7ab891d2cb6127b4cba428a0f7c13b9d2ce.tar.gz |
Future versions of Ruby may change this from the default *nix behavior, so we need to explicitly allow FD passing via exec(). ref: http://redmine.ruby-lang.org/issues/5041
Diffstat (limited to 'lib/unicorn')
-rw-r--r-- | lib/unicorn/http_server.rb | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/lib/unicorn/http_server.rb b/lib/unicorn/http_server.rb index 78d80b4..ad5d6f0 100644 --- a/lib/unicorn/http_server.rb +++ b/lib/unicorn/http_server.rb @@ -408,7 +408,13 @@ class Unicorn::HttpServer end self.reexec_pid = fork do - listener_fds = LISTENERS.map { |sock| sock.fileno } + listener_fds = LISTENERS.map do |sock| + # IO#close_on_exec= will be available on any future version of + # Ruby that sets FD_CLOEXEC by default on new file descriptors + # ref: http://redmine.ruby-lang.org/issues/5041 + sock.close_on_exec = false if sock.respond_to?(:close_on_exec=) + sock.fileno + end ENV['UNICORN_FD'] = listener_fds.join(',') Dir.chdir(START_CTX[:cwd]) cmd = [ START_CTX[0] ].concat(START_CTX[:argv]) |