about summary refs log tree commit homepage
path: root/t/fork-sleep.ru
diff options
context:
space:
mode:
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