diff options
author | Gurusamy Sarathy <gsar@cpan.org> | 2000-03-19 08:49:27 +0000 |
---|---|---|
committer | Gurusamy Sarathy <gsar@cpan.org> | 2000-03-19 08:49:27 +0000 |
commit | 227e8dd41da683de6280c9d2acd3b6b29fd52832 (patch) | |
tree | 57f32814ace95f583288065ea289d50599a1738a /lib/IPC | |
parent | c88ded472108aed93bd950f5d5a2f4013112b680 (diff) | |
download | perl-227e8dd41da683de6280c9d2acd3b6b29fd52832.tar.gz |
mention need to wait for children (from Russ Allbery)
p4raw-id: //depot/perl@5826
Diffstat (limited to 'lib/IPC')
-rw-r--r-- | lib/IPC/Open2.pm | 7 | ||||
-rw-r--r-- | lib/IPC/Open3.pm | 7 |
2 files changed, 14 insertions, 0 deletions
diff --git a/lib/IPC/Open2.pm b/lib/IPC/Open2.pm index 161620ba24..a5a3561794 100644 --- a/lib/IPC/Open2.pm +++ b/lib/IPC/Open2.pm @@ -55,6 +55,13 @@ failure: it just raises an exception matching C</^open2:/>. However, C<exec> failures in the child are not detected. You'll have to trap SIGPIPE yourself. +open2() does not wait for and reap the child process after it exits. +Except for short programs where it's acceptable to let the operating system +take care of this, you need to do this yourself. This is normally as +simple as calling C<waitpid $pid, 0> when you're done with the process. +Failing to do this can result in an accumulation of defunct or "zombie" +processes. See L<perlfunc/waitpid> for more information. + This whole affair is quite dangerous, as you may block forever. It assumes it's going to talk to something like B<bc>, both writing to it and reading from it. This is presumably safe because you diff --git a/lib/IPC/Open3.pm b/lib/IPC/Open3.pm index d43f1bdb4b..99709ac0ca 100644 --- a/lib/IPC/Open3.pm +++ b/lib/IPC/Open3.pm @@ -49,6 +49,13 @@ failure: it just raises an exception matching C</^open3:/>. However, C<exec> failures in the child are not detected. You'll have to trap SIGPIPE yourself. +open2() does not wait for and reap the child process after it exits. +Except for short programs where it's acceptable to let the operating system +take care of this, you need to do this yourself. This is normally as +simple as calling C<waitpid $pid, 0> when you're done with the process. +Failing to do this can result in an accumulation of defunct or "zombie" +processes. See L<perlfunc/waitpid> for more information. + If you try to read from the child's stdout writer and their stderr writer, you'll have problems with blocking, which means you'll want to use select() or the IO::Select, which means you'd best use |