my $stderr_duped = 0;
local *STDERR_COPY;
- if( open(STDERR_COPY, '>&STDERR') ) {
- $stderr_duped = 1;
- }
- else {
- warn <<WARNING;
+ unless ($^O =~ /^(?:free|net|open)bsd|bsdos$/) { # Search for '51535'.
+ if( open(STDERR_COPY, '>&STDERR') ) {
+ $stderr_duped = 1;
+ }
+ else {
+ warn <<WARNING;
find_perl() can't dup STDERR: $!
You might see some garbage while we search for Perl
WARNING
+ }
}
foreach $name (@$names){
next unless $self->maybe_command($abs);
print "Executing $abs\n" if ($trace >= 2);
- # To avoid using the unportable 2>&1 to supress STDERR,
- # we close it before running the command.
- close STDERR if $stderr_duped;
my $version_check = qq{$abs -e "require $ver; print qq{VER_OK\n}"};
- $val = `$version_check`;
- open STDERR, '>&STDERR_COPY' if $stderr_duped;
+ # To avoid using the unportable 2>&1 to suppress STDERR,
+ # we close it before running the command.
+ # However, thanks to a thread library bug in many BSDs
+ # ( http://www.freebsd.org/cgi/query-pr.cgi?pr=51535 )
+ # we cannot use the fancier more portable way in here
+ # but instead need to use the traditional 2>&1 construct.
+ if ($^O =~ /^(?:free|net|open)bsd|bsdos$/) {
+ $val = `$version_check 2>&1`;
+ } else {
+ close STDERR if $stderr_duped;
+ $val = `$version_check`;
+ open STDERR, '>&STDERR_COPY' if $stderr_duped;
+ }
print STDERR "Perl version check failed: '$version_check'\n"
unless defined $val;