On Sep 18, 2006, at 11:55 AM, Ovid wrote:
I have a bit of a problem, I think. It could simply be a matter of
misunderstanding how things work, but I have the following bit of
code in TAPx::Parser::Source::Perl:
my $sym = gensym;
if ( open $sym, "$command 2>&1 |" ) {
return TAPx::Parser::Iterator->new($sym);
}
else {
$self->exit($? >> 8);
$self->error("Could not execute ($command): $!");
warn $self->error;
return;
}
I've gotten a report that the open command fails on Windows. Not a
surprise, now that I think about it. However, I don't know of any
portable way of forcing STDERR to STDOUT (and I don't have a
Windows box handy). This means that my 2000+ TAPx::Parser tests
are in trouble. If Test::Builder accepted an environment variable
which allowed me to override this, I might have a way out. So far
removing the 2>&1 seems to make my tests pass on a Linux box, but
that strikes me as bizarre as I thought STDERR wouldn't get read
that way. What the heck am I misunderstanding?
Cheers,
Ovid
Try IPC::Open3, it's in the Perl core.
http://search.cpan.org/perldoc?IPC::Open3
IPC::Run3 is supposed to be good on Windows, but I haven't tried it
enough.
http://search.cpan.org/perldoc?IPC::Run3
Finally, you can try duplicating the STDOUT filehandle and saving it
in STDERR. Does this work as expected in Windows?
open STDERR, '&STDOUT';
Chris
--
Chris Dolan, Software Developer, Clotho Advanced Media Inc.
608-294-7900, fax 294-7025, 1435 E Main St, Madison WI 53703
vCard: http://www.chrisdolan.net/ChrisDolan.vcf
Clotho Advanced Media, Inc. - Creators of MediaLandscape Software
(http://www.media-landscape.com/) and partners in the revolutionary
Croquet project (http://www.opencroquet.org/)