in reply to IPC:Open2 question

waitpid PID,FLAGS
Waits for a particular child process to terminate and returns the pid of the deceased process, or -1 if there is no such child process.

(Also, note that the flag 0 indicates a blocking wait. On systems that support it the WNOHANG flag causes an immediate return if the child pid is not dead.)

Replies are listed 'Best First'.
Re^2: IPC:Open2 question
by Anonymous Monk on Jul 13, 2004 at 18:24 UTC
    Yes, I understod what waitpid does (I think), but why does the process not terminate? That's why I said it terminates ok when just run from the shell... The WNOHANG flag does not change anything.
      I did some testing using an ancient DOS port of "od" as my program.exe. On a win98 box running perl 5.8.3, closing WRITEME immediately after printing to WRITEME fixes the problem.

      On a win2k box with perl 5.8.4, running the "fixed" program locks up until "od" is manually killed. However, the problem occurs not at the waitpid command, but at the $output = <README>; command.

      Try using "perl -d:ptkdb perlprog inputfile" (assumes you have Devel::Ptkdb installed) and step through the program.