about summary refs log tree commit homepage
path: root/t/fork-sleep.ru
diff options
context:
space:
mode:
authorEric Wong <normalperson@yhbt.net>2009-11-28 11:43:45 -0800
committerEric Wong <normalperson@yhbt.net>2009-11-28 12:19:21 -0800
commitf824f4e13a13daf56439e16ecb3a62469a8c9bf0 (patch)
tree162c80491bdf7ad7d258479af092c23a5557c2be /t/fork-sleep.ru
parent2489368a624cff50a330238cf3c3f16eb0bd743c (diff)
downloadrainbows-f824f4e13a13daf56439e16ecb3a62469a8c9bf0.tar.gz
Some people fork processes, so it avoid hanging a connection
open because of that...
Diffstat (limited to 't/fork-sleep.ru')
-rw-r--r--t/fork-sleep.ru10
1 files changed, 10 insertions, 0 deletions
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