in reply to Forking Issue
The child keeps writing and writing to the pipe, but nothing is emptying the pipe.
Once the pipe becomes full, the child blocks until the pipe becomes empty enough to handle the write.
Of course, that's never gonna happen in your program since the "reader" is spending its time waiting for the child to end rather than emptying the pipe.
You have what is called a deadlock. The child is blocked waiting for the parent to empty the pipe, the parent is blocked waiting for the child to exit.
Change
waitpid($pid, 0); my @data = (<READER>);
to
my @data = (<READER>); waitpid($pid, 0);
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Forking Issue
by nwboy74 (Novice) on Oct 20, 2010 at 22:12 UTC |