A invocation of Parrot::Test::run_command with an filehandle for STDOUT
as in t/native_pbc/header.t will lead to the error.
TODO:
Check for filehandle before comparing with eq to '/dev/null'
Attached patch fixes this issue for older perls.
The filehandles are stringified to the filename.
Tested down to perl-5.8.4.
--
Reini Urban
http://phpwiki.org/ http://murbreak.at/
Index: t/native_pbc/header.t
===================================================================
--- t/native_pbc/header.t (revision 31096)
+++ t/native_pbc/header.t (working copy)
@@ -38,7 +38,9 @@
Parrot::Test::run_command
(
qq{$parrot $args -o $out_f $tmppasm},
- CD => $path_to_parrot
+ CD => $path_to_parrot,
+ STDOUT => $out_f,
+ STDERR => $out_f,
);
my $pbc = slurp_file($out_f);
Index: lib/Parrot/Test.pm
===================================================================
--- lib/Parrot/Test.pm (revision 31090)
+++ lib/Parrot/Test.pm (working copy)
@@ -309,9 +309,10 @@
while ( my ( $key, $value ) = each %options ) {
$key =~ m/^STD(OUT|ERR)$/
or die "I don't know how to redirect '$key' yet!";
- $value = File::Spec->devnull()
- if $value eq '/dev/null'; # TODO filehandle `eq' string will fail
- } # on older perls
+ my $strvalue = "$value"; # filehandle `eq' string will fail
+ $value = File::Spec->devnull() # on older perls, so stringify it
+ if $strvalue eq '/dev/null';
+ }
my $out = $options{'STDOUT'} || '';
my $err = $options{'STDERR'} || '';
@@ -330,7 +331,7 @@
}
}
- if ( $out and $err and $out eq $err ) {
+ if ( $out and $err and "$out" eq "$err" ) {
$err = "&STDOUT";
}