On Friday, April 26, 2002, at 09:40 , Alex Read wrote:
> Hello, > > OK, we now have the following; > > #!/usr/bin/perl > use strict; > > my $pid = fork; > if ($pid == 0){ > exec 'sleep 2; echo "hi"' || die "Cannot sleep: $!" ; > } else { > print "Content-type: text/html\n\n<html>"; > print "\nhi\n\n</html>\n\n"; > } > > So the child process is the only one that sleeps for 2, then prints hi, > and > the parent prints Content-type etc., and on the command line thats exactly > what it does. I get Content-type etc. straight away, the two seconds > later > I get hi. But, when I run this as a cgi script my browser hangs for 2 > seconds and then prints hi hi. three sets of concerns: p0: the exec there is still attached to 'STDOUT' - hence STDOUT remains open for 2 seconds - even if the Initial print to the buffer STDOUT by the parent occured already. p1: $| = 1; would turn buffering off { but I am not sure what the browser would do with getting the non-html stuff from the child } p2: having the child need to communicate with the browser over the same STDOUT - can get messy.... as you are starting to notice.... and would be time to rethink the design here... ciao drieux --- -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]