summary refs log tree commit homepage
path: root/t/fork-sleep.ru
blob: 1523c25e413a6456b6a32eb0733ff080e00edd4d (plain)
1
2
3
4
5
6
7
8
9
# 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