From f824f4e13a13daf56439e16ecb3a62469a8c9bf0 Mon Sep 17 00:00:00 2001 From: Eric Wong Date: Sat, 28 Nov 2009 11:43:45 -0800 Subject: always set FD_CLOEXEC if available Some people fork processes, so it avoid hanging a connection open because of that... --- t/fork-sleep.ru | 10 ++++++++++ 1 file changed, 10 insertions(+) create mode 100644 t/fork-sleep.ru (limited to 't/fork-sleep.ru') diff --git a/t/fork-sleep.ru b/t/fork-sleep.ru new file mode 100644 index 0000000..747a06d --- /dev/null +++ b/t/fork-sleep.ru @@ -0,0 +1,10 @@ +#\-E none +# we do not want Rack::Lint or anything to protect us +use Rack::ContentLength +use Rack::ContentType, "text/plain" +trap(:CHLD) { $stderr.puts Process.waitpid2(-1).inspect } +map "/" do + time = ENV["nr"] || '15' + pid = fork { exec('sleep', time) } + run lambda { |env| [ 200, {}, [ "#{pid}\n" ] ] } +end -- cgit v1.2.3-24-ge0c7