diff options
author | Eric Wong <normalperson@yhbt.net> | 2013-10-20 00:50:26 +0000 |
---|---|---|
committer | Eric Wong <normalperson@yhbt.net> | 2013-10-20 00:50:26 +0000 |
commit | 5de2a9567f73d38e3492db2ae40b6c332c9aacd6 (patch) | |
tree | cf95585ea62a7035f5e3f85ea14913d55c0fffd3 /lib/yahns/config.rb | |
parent | 2231035fd7a73629123eb76438ffabbefa807ad7 (diff) | |
download | yahns-5de2a9567f73d38e3492db2ae40b6c332c9aacd6.tar.gz |
This means ruby 1.9.3 should be supported, as well as Ruby implementations which do not set the close-on-exec flag by default. Note: this is only best-effort outside of modern Linux with threads, since a multithreaded process may create and inadvertantly share descriptors. This is why Linux supports O_CLOEXEC, SOCK_CLOEXEC and friends, as kernel support is the only way to sanely fix this.
Diffstat (limited to 'lib/yahns/config.rb')
-rw-r--r-- | lib/yahns/config.rb | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/lib/yahns/config.rb b/lib/yahns/config.rb index 3f4bb90..bdd03d6 100644 --- a/lib/yahns/config.rb +++ b/lib/yahns/config.rb @@ -317,8 +317,8 @@ class Yahns::Config # :nodoc: if String === val # we've already bound working_directory by the time we get here val = File.open(File.expand_path(val), "a") + val.close_on_exec = val.sync = true val.binmode - val.sync = true else rt = %w(puts write flush).map(&:to_sym) # match Rack::Lint rt.all? { |m| val.respond_to?(m) } or raise ArgumentError, @@ -335,7 +335,7 @@ class Yahns::Config # :nodoc: @set[key] = path = "/dev/null" end File.open(path, 'a') { |fp| io.reopen(fp) } if String === path - io.sync = true + io.close_on_exec = io.sync = true end [ :logger, :pid, :worker_processes ].each do |var| |