Hello everybody,

I'm using fork with a simple application, and it looks like if the
father process continues executing without waiting his child, the
following is the code that i use:
                                        my $redirected=1;
                                        my $pid=fork();
                                        if($pid == 0){ #this the child
                                        my @output=`date`;                             
         
                                        $Vocp->log_msg("THIS IS THE
CHILD WHICH \$pid  IS $pid>>>>@output");
                                        my $redirected=$Vocp->dial(32);
                                        $Vocp->log_msg("REDIRECTION
DONE, AND \$redirected is
$redirected\n");                                       
                                        exit(0);
                                        }elsif($pid != 0){
                                        wait;
                                        my @output=`date`;
                                        $Vocp->log_msg("THIS IS THE
FATHER AND \$pid is $pid>>>@output\n");
                                        }else{
                                        $Vocp->log_msg("I DON'T KNOW
WAHT THE HELL IS GOING UP HERE !!!!!!!!!!!\n");
                                       
}                                                

$vocp->log_msg is method to write a message to estandard error (which
was previously redirected to a file)
$vocp->dial() it makes a call to a phone

the output error file is

/etc/mgetty+sendfax/vocp/vocp.pl.st.trans [2403]: Redirection could go
for  032, which is command box in VOCP=HASH(0x811893c)
/etc/mgetty+sendfax/vocp/vocp.pl.st.trans [2403]: Redirection certainly
goes for 032 which is command in VOCP=HASH(0x811893c)
/etc/mgetty+sendfax/vocp/vocp.pl.st.trans [2463]: THIS IS THE CHILD
WHICH $pid  IS 0>>>Mon Jun  4 13:58:36 CDT 2001
 @@@@@@@ here is the problem the father is writting before the child
ends
/etc/mgetty+sendfax/vocp/vocp.pl.st.trans [2403]: THIS IS THE FATHER AND
$pid is 2463>>>Mon Jun  4 13:58:36 CDT 2001
/etc/mgetty+sendfax/vocp/vocp.pl.st.trans [2403]: Redirection certainly
went  for 032 which is command in VOCP=HASH(0x811893c) and sucesfull
/etc/mgetty+sendfax/vocp/vocp.pl.st.trans [2403]: Disconnecting from
vgetty
@@@@@@@@ and the consecuence is disconected, so i can't dialout 
/etc/mgetty+sendfax/vocp/vocp.pl.st.trans [2463]: TRYING TO DIAL
32>>>>Mon Jun  4 13:58:36 CDT 2001
/etc/mgetty+sendfax/vocp/vocp.pl.st.trans [2463]: Got "GOODBYE SHELL"
/etc/mgetty+sendfax/vocp/vocp.pl.st.trans [2463]: PREVIOUS $RESP TO
DIAL>>>> GOODBYE SHELL <<<<
/etc/mgetty+sendfax/vocp/vocp.pl.st.trans [2403]: Sent "GOODBYE"
/etc/mgetty+sendfax/vocp/vocp.pl.st.trans [2403]: Got "READY"
/etc/mgetty+sendfax/vocp/vocp.pl.st.trans Mon Jun  4 13:58:36 2001
[2403] Fatal: Sent "GOODBYE". Expected "GOODBYE SHELL". Got "READY".
(VGETTY)
/etc/mgetty+sendfax/vocp/vocp.pl.st.trans [2463]: Sent "STOP"
/etc/mgetty+sendfax/vocp/vocp.pl.st.trans [2463]: Got ""
/etc/mgetty+sendfax/vocp/vocp.pl.st.trans Mon Jun  4 13:58:36 2001
[2463] Fatal: Sent "STOP". Expected "READY". Got "".
(VGETTY)                                


i was expecting something like, dialout then disconected, etc..

am i well debugging the system?, or is there another way?
does someone have any idea about this?

thanks for all.

Ulises

Reply via email to