summaryrefslogtreecommitdiff
path: root/lib/IPC/Cmd.pm
diff options
context:
space:
mode:
authorJos I. Boumans <kane@dwim.org>2007-10-11 19:24:50 +0200
committerRafael Garcia-Suarez <rgarciasuarez@gmail.com>2007-10-11 15:41:55 +0000
commitcce6d045dc7c10e0ae53901ce375a88a7bd3205e (patch)
treefd4cb22e029739a2725ac0357d3725beea39b54e /lib/IPC/Cmd.pm
parent19119994cb808157abfddb5879338976e13d711a (diff)
downloadperl-cce6d045dc7c10e0ae53901ce375a88a7bd3205e.tar.gz
Update IPC::Cmd to 0.38
From: "Jos I. Boumans" <jos@dwim.org> Message-Id: <E88BE0DB-CA4E-4798-AB5B-3D45D1B5799B@dwim.org> p4raw-id: //depot/perl@32101
Diffstat (limited to 'lib/IPC/Cmd.pm')
-rw-r--r--lib/IPC/Cmd.pm45
1 files changed, 26 insertions, 19 deletions
diff --git a/lib/IPC/Cmd.pm b/lib/IPC/Cmd.pm
index 3e8e6d22da..ce668b172e 100644
--- a/lib/IPC/Cmd.pm
+++ b/lib/IPC/Cmd.pm
@@ -13,7 +13,7 @@ BEGIN {
$USE_IPC_RUN $USE_IPC_OPEN3 $WARN
];
- $VERSION = '0.36_01';
+ $VERSION = '0.38';
$VERBOSE = 0;
$DEBUG = 0;
$WARN = 1;
@@ -25,6 +25,7 @@ BEGIN {
}
require Carp;
+use File::Spec;
use Params::Check qw[check];
use Module::Load::Conditional qw[can_load];
use Locale::Maketext::Simple Style => 'gettext';
@@ -186,9 +187,10 @@ sub can_run {
return MM->maybe_command($command);
} else {
- for my $dir ((split /\Q$Config::Config{path_sep}\E/, $ENV{PATH}),
- File::Spec->curdir()
- ) {
+ for my $dir (
+ (split /\Q$Config::Config{path_sep}\E/, $ENV{PATH}),
+ File::Spec->curdir
+ ) {
my $abs = File::Spec->catfile($dir, $command);
return $abs if $abs = MM->maybe_command($abs);
}
@@ -437,6 +439,8 @@ sub _open3_run {
### add an epxlicit break statement
### code courtesy of theorbtwo from #london.pm
+ my $stdout_done = 0;
+ my $stderr_done = 0;
OUTER: while ( my @ready = $selector->can_read ) {
for my $h ( @ready ) {
@@ -457,9 +461,12 @@ sub _open3_run {
### if we would print anyway, we'd provide bogus information
$_out_handler->( "$buf" ) if $len && $h == $kidout;
$_err_handler->( "$buf" ) if $len && $h == $kiderror;
-
- ### child process is done printing.
- last OUTER if $h == $kidout and $len == 0
+
+ ### Wait till child process is done printing to both
+ ### stdout and stderr.
+ $stdout_done = 1 if $h == $kidout and $len == 0;
+ $stderr_done = 1 if $h == $kiderror and $len == 0;
+ last OUTER if ($stdout_done && $stderr_done);
}
}
@@ -671,7 +678,7 @@ settings honored cleanly.
Otherwise, if the variable C<$IPC::Cmd::USE_IPC_OPEN3> is set to true
(See the C<GLOBAL VARIABLES> Section), try to execute the command using
C<IPC::Open3>. Buffers will be available on all platforms except C<Win32>,
-interactive commands will still execute cleanly, and also your verbosity
+interactive commands will still execute cleanly, and also your verbosity
settings will be adhered to nicely;
=item *
@@ -764,22 +771,22 @@ however, since you can just inspect your buffers for the contents.
C<IPC::Run>, C<IPC::Open3>
-=head1 AUTHOR
-
-This module by
-Jos Boumans E<lt>kane@cpan.orgE<gt>.
-
=head1 ACKNOWLEDGEMENTS
Thanks to James Mastros and Martijn van der Streek for their
help in getting IPC::Open3 to behave nicely.
+=head1 BUG REPORTS
+
+Please report bugs or other issues to E<lt>bug-ipc-cmd@rt.cpan.orgE<gt>.
+
+=head1 AUTHOR
+
+This module by Jos Boumans E<lt>kane@cpan.orgE<gt>.
+
=head1 COPYRIGHT
-This module is
-copyright (c) 2002 - 2006 Jos Boumans E<lt>kane@cpan.orgE<gt>.
-All rights reserved.
+This library is free software; you may redistribute and/or modify it
+under the same terms as Perl itself.
-This library is free software;
-you may redistribute and/or modify it under the same
-terms as Perl itself.
+=cut