[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index][Thread Index][Top&Search][Original]

[PATCH] Show using waitpid in IPC::Open[23] SYNOPSIS



* The docs for IPC::Open2 and IPC::Open3 tell you that you should
 probably use waitpid to clean up, so show that in the SYNOPSIS.

---
 lib/IPC/Open2.pm |    3 +++
 lib/IPC/Open3.pm |    3 +++
 2 files changed, 6 insertions(+), 0 deletions(-)

diff --git a/lib/IPC/Open2.pm b/lib/IPC/Open2.pm
index ecd1e7f..eb99689 100644
--- a/lib/IPC/Open2.pm
+++ b/lib/IPC/Open2.pm
@@ -28,6 +28,9 @@ IPC::Open2, open2 - open a process for both reading
and writing
       # or without using the shell
     $pid = open2($chld_out, $chld_in, 'some', 'cmd', 'and', 'args');
 
+  waitpid( $pid, 0 );
+  my $child_exit_status = $? >> 8;
+
 =head1 DESCRIPTION
 
 The open2() function runs the given $cmd and connects $chld_out for
diff --git a/lib/IPC/Open3.pm b/lib/IPC/Open3.pm
index f934e89..ae62861 100644
--- a/lib/IPC/Open3.pm
+++ b/lib/IPC/Open3.pm
@@ -26,6 +26,9 @@ IPC::Open3, open3 - open a process for reading,
writing, and error handling
     $pid = open3($wtr, $rdr, $err,
          'some cmd and args', 'optarg', ...);
 
+  waitpid( $pid, 0 );
+  my $child_exit_status = $? >> 8;
+
 =head1 DESCRIPTION
 
 Extremely similar to open2(), open3() spawns the given $cmd and
-- 
1.5.4


Follow-Ups from:
"Steve Peters" <steve@fisharerojo.org>

[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index][Thread Index][Top&Search][Original]