in reply to Cgi , fork , output data
You are checking whether the child is alive. It is, so you go into this if block. However, both the parent and the child go into this block, whereas it is your intention to have only the parent get into this block, and have the child execute the else block. Change this line to:if(kill(0,$Kind_pid)) {
and watch the dots march across the screen :).if ($Kind_pid) {
If you are worried about not properly forking, you can always check for the child's existence (with kill 0) inside the parent's if block.
Update: Better yet, if you are worried about not forking properly, check for the definedness of the return value of fork:
die "Could not fork: $!\n" unless (defined(my $Kind_pid = fork() ));
CU
Robartes-
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Re: Cgi , fork , output data
by jreades (Friar) on Mar 11, 2003 at 10:28 UTC | |
by tzvik (Initiate) on Mar 11, 2003 at 10:59 UTC | |
|
Re: Re: Cgi , fork , output data
by tzvik (Initiate) on Mar 11, 2003 at 10:46 UTC |