From cce6d045dc7c10e0ae53901ce375a88a7bd3205e Mon Sep 17 00:00:00 2001 From: "Jos I. Boumans" Date: Thu, 11 Oct 2007 19:24:50 +0200 Subject: Update IPC::Cmd to 0.38 From: "Jos I. Boumans" Message-Id: p4raw-id: //depot/perl@32101 --- lib/IPC/Cmd.pm | 45 ++++++++++++++++++++++++++------------------- 1 file changed, 26 insertions(+), 19 deletions(-) (limited to 'lib/IPC/Cmd.pm') 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 Section), try to execute the command using C. Buffers will be available on all platforms except C, -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, C -=head1 AUTHOR - -This module by -Jos Boumans Ekane@cpan.orgE. - =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 Ebug-ipc-cmd@rt.cpan.orgE. + +=head1 AUTHOR + +This module by Jos Boumans Ekane@cpan.orgE. + =head1 COPYRIGHT -This module is -copyright (c) 2002 - 2006 Jos Boumans Ekane@cpan.orgE. -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 -- cgit v1.2.1