We need to wait for the hijacked process to run and write to the log before we check it. Since we may not have inotify, try to trigger a sched_yield() syscall instead. --- test/test_rack_hijack.rb | 4 ++++ 1 file changed, 4 insertions(+)
diff --git a/test/test_rack_hijack.rb b/test/test_rack_hijack.rb index 5bfc31f..2a9f23e 100644 --- a/test/test_rack_hijack.rb +++ b/test/test_rack_hijack.rb @@ -62,6 +62,10 @@ class TestRackHijack < Testcase assert_equal "zzz", res["X-Test"] assert_equal "1.1", res.http_version + # hope this calls sched_yield() so the forked process runs and writes + # to the log. + Thread.new { Thread.pass }.join + errs = File.readlines(err.path).grep(/DieIfUsed/) assert_equal([ "INFO #{pid} closed DieIfUsed 1\n", "INFO #{pid} closed DieIfUsed 2\n" ], errs) -- EW