in reply to Re^3: Fork Causing <defunct>
in thread Fork Causing <defunct>

To have the child waiting on the parent looks like this:
}elsif($pid == 0){ # This is the child, it will log when the parent is done + + while(!&parentIsDead){sleep(10);} # &finalLog($traceFileToLog); + + &finalLog($traceFileToLog, $initialString); exit(0); sub parentIsDead { if(getppid()==1){ return 1; } return 0; }

Replies are listed 'Best First'.
Re^5: Fork Causing <defunct>
by almut (Canon) on Mar 18, 2010 at 17:37 UTC

    I think there's some confusion as to what "wait" is referring to. You seem to be referring to the normal meaning of the English word, while the others are talking about the Unix system call of the same name...  Only the latter will prevent "<defunct>" processes.