summaryrefslogtreecommitdiffabout
Side-by-side diff
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--Changes5
-rw-r--r--capture.c2
-rw-r--r--lib/POSIX/Run/Capture.pm22
3 files changed, 18 insertions, 11 deletions
diff --git a/Changes b/Changes
index 7238169..d14733e 100644
--- a/Changes
+++ b/Changes
@@ -2,2 +2,7 @@ Revision history for Perl extension POSIX::Run::Capture.
+1.01 Fri Jan 31 09:16:30 2020
+ - Argument to the 'stderr' or 'stdout' can be a code reference,
+ glob (file handle) or scalar string. In the latter two cases,
+ the stream is redirected to the file handle or the named file.
+
1.00 Wed Aug 14 08:11:53 2019
diff --git a/capture.c b/capture.c
index d5828ea..a925692 100644
--- a/capture.c
+++ b/capture.c
@@ -155,3 +155,3 @@ capture_set_output(struct capture *cp, SV *cb[2], int strno)
char *filename = SvPV_nolen(sv);
- int fd = open(filename, O_CREAT|O_TRUNC|O_RDWR, 0777);
+ int fd = open(filename, O_CREAT|O_TRUNC|O_RDWR, 0666);
if (fd == -1) {
diff --git a/lib/POSIX/Run/Capture.pm b/lib/POSIX/Run/Capture.pm
index 57c7d57..35275c1 100644
--- a/lib/POSIX/Run/Capture.pm
+++ b/lib/POSIX/Run/Capture.pm
@@ -30,3 +30,3 @@ our @EXPORT_OK = ( @{ $EXPORT_TAGS{'all'} } );
-our $VERSION = '1.00_01';
+our $VERSION = '1.01';
@@ -70,4 +70,4 @@ POSIX::Run::Capture - run command and capture its output
stdin => $fh_or_string,
- stdout => sub { ... },
- stderr => sub { ... },
+ stdout => $ref_or_string,
+ stderr => $ref_or_string,
timeout => $n);
@@ -96,3 +96,3 @@ Runs an external command and captures its output. Both standard error and
output can be captured. Standard input can be supplied as either a
-filehandle or a text. Upon exit, the captured streams can be accessed line
+filehandle or a string. Upon exit, the captured streams can be accessed line
by line or in one chunk. Callback routines can be supplied that will be
@@ -149,3 +149,4 @@ Notice that the last line read can lack the teminating newline character.
-Capture standard output and write it to the file handle I<FH>.
+Redirect standard output to file handle I<FH>. Obviously, the handle should
+be writable.
@@ -154,3 +155,4 @@ Capture standard output and write it to the file handle I<FH>.
Capture standard output and write it to the file I<NAME>. If the file
-exists, it will be truncated.
+exists, it will be truncated. Otherwise, it will be created with permissions
+of 0666 modified by the process' "umask" value.
@@ -159,4 +161,4 @@ exists, it will be truncated.
Sets the I<line monitor> function for standard error or redirects it to
-the file handle or file, depending on the type of I<$arg>. See the
-description of B<stdout> above.
+the file handle or file, depending on the type of I<$arg> (CODE reference,
+GLOB or scalar string). For details, see the description of B<stdout> above.
@@ -184,3 +186,3 @@ and B<set_timeout>.
-Monitors can be defined only when creating the object.
+Monitors and redirections can be defined only when creating the object.
@@ -295,3 +297,3 @@ Sergey Poznyakoff, E<lt>gray@gnu.orgE<gt>
-Copyright (C) 2017 by Sergey Poznyakoff
+Copyright (C) 2017-2020 by Sergey Poznyakoff

Return to:

Send suggestions and report system problems to the System administrator.