I want a CGI script to fire off another process and continue executing
(or even terminate) without waiting for the process to finish. I wrote
this:

#!/usr/bin/ruby
require 'cgi'
c = CGI.new
fork do sleep 5 end
c.out {"hello!\n"}

When I execute that from the command line, it IMMEDIATELY prints
"Content-Type...hello!" and exits. When I run it on Apache and access it
from my browser, on the other hand, it PAUSES for five seconds, THEN
displays "hello!".

What's going on? Why does it behave differently with Apache?

I am using Apache/2.2.12 (Ubuntu) with ruby 1.8.7 (2009-06-12 patchlevel
174) [x86_64-linux].

Thanks in advance...
-- 
Posted via http://www.ruby-forum.com/.