future-proof against close-on-exec by default
commit6ab27beeda3b0aaaa66f7cc4f734944a7aa84385
authorEric Wong <normalperson@yhbt.net>
Thu, 11 Aug 2011 19:59:09 +0000 (11 12:59 -0700)
committerEric Wong <normalperson@yhbt.net>
Thu, 11 Aug 2011 20:06:59 +0000 (11 13:06 -0700)
tree301813838b8dc926a4f5d927b29010efd4a5170d
parent60d60a6fa716e91651997d86e3cb9cda41475975
future-proof against close-on-exec by default

Setting the close-on-exec flag by default and closing
non-standard descriptors is proposed for Ruby 1.9.4/2.0.0.
Since Unicorn is one of the few apps to rely on FD inheritance
across exec(), we need to workaround this by redirecting each
listener FD to itself for Kernel#exec.

Ruby supports a hash as the final argument to Kernel#exec since
at least 1.9.1 (nobody cares for 1.9.0 anymore). This allows
users to backport close-on-exec by default patches to older
1.9.x installs without breaking anything.

ref: http://redmine.ruby-lang.org/issues/5041
lib/unicorn/http_server.rb