diff options
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 |