Subject: | Errors redirecting STDERR on Windows XP SP3 |
Hi,
Despite the successes on Win32 on CPAN Testers, IPC::Exe is failing
tests on a Windows XP SP3 system running strawberry Perl 5.18.2. In
particular, it seems to be failing tests which read or redirect
STDERR. I've attached a log of the errors and of the results of
running 'perl -v'.
I've reduced the code to that in the attached file. If run as
perl -s try.pl -output=stdout
the child process will write to stdout with no capturing. This results in:
-------------------------------------------------
line1
line2
line3
-------------------------------------------------
which is expected. Capturing stdout via
perl -s try.pl -output=stdout -capture_stdout
results in
-------------------------------------------------
$VAR1 = {
'stdout' => [
'line1
',
'line2
',
'line3
'
]
};
-------------------------------------------------
which is also expected. Output to stderr works:
perl -s try.pl -output=stderr
-------------------------------------------------
line4
line5
line6
-------------------------------------------------
but capturing to stderr doesn't:
-------------------------------------------------
$VAR1 = {
'stderr' => []
};
-------------------------------------------------
Weirder, outputing to stdout and capturing stderr does not work:
-------------------------------------------------
$VAR1 = {
'stderr' => []
};
-------------------------------------------------
All of the above work as expected on a Linux box.
I know little to nothing about Windows, but I'm willing to poke at it
if given directions.
Thanks,
Diab
Subject: | errors |
Message body not shown because it is not plain text.
Subject: | perl-v |
Message body not shown because it is not plain text.
Subject: | try.pl |
use IPC::Exe 'exe';
use Data::Dumper;
# create generators
my %gen = (
stdout =>
[ $^X, '-le', 'print STDOUT $_ for qw(line1 line2 line3); exit 44' ],
stderr =>
[ $^X, '-le', 'print STDERR $_ for qw(line4 line5 line6); exit 77' ],
);
my @fh;
my ( $pid, @fh ) = &{ exe +{ stdout => $capture_stdout//0,
stderr => $capture_stderr//0 },
@{ $gen{$output // 'stdout' } } };
my %res = (
$capture_stdout ? do { my $fh = shift @fh; ( stdout => [ <$fh> ] ) } : (),
$capture_stderr ? do { my $fh = shift @fh; ( stderr => [ <$fh> ] ) } : (),
);
print Dumper \%res if %res;