From 7c0a500a7d0ecdd6e01d74e88ebc3b140ab810a7 Mon Sep 17 00:00:00 2001 From: brian d foy Date: Thu, 7 Dec 2023 18:48:42 -0500 Subject: [PATCH] Use WNOHANG, which should work even for windows --- lib/Pod/Perldoc/ToMan.pm | 3 ++- t/lib/TestUtils.pm | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/lib/Pod/Perldoc/ToMan.pm b/lib/Pod/Perldoc/ToMan.pm index b7673c5..24b5e5f 100644 --- a/lib/Pod/Perldoc/ToMan.pm +++ b/lib/Pod/Perldoc/ToMan.pm @@ -3,6 +3,7 @@ package Pod::Perldoc::ToMan; use strict; use warnings; use parent qw(Pod::Perldoc::BaseTo); +use POSIX qw( WNOHANG ); use vars qw($VERSION); $VERSION = '3.28'; @@ -362,7 +363,7 @@ sub _filter_through_nroff { ); # wait for it to exit - waitpid( $pid, 0 ) unless $^O eq 'MSWin32'; # see perlport, this will hang on Windows + waitpid( $pid, WNOHANG ); if( $? ) { $self->warn( "Error from pipe to $render!\n" ); diff --git a/t/lib/TestUtils.pm b/t/lib/TestUtils.pm index 41c9c14..eed953a 100644 --- a/t/lib/TestUtils.pm +++ b/t/lib/TestUtils.pm @@ -6,6 +6,7 @@ use Data::Dumper; use Exporter qw(import); use File::Spec::Functions qw(catfile); use IPC::Open3; +use POSIX qw( WNOHANG ); use Symbol; our @EXPORT = qw( @@ -36,7 +37,7 @@ sub run_perldoc { my $success = length($at) == 0; return { success => !!0 } unless $pid; - waitpid( $pid, 0 ) unless $^O eq 'MSWin32'; # see perlport, this will hang + waitpid( $pid, WNOHANG ); my $output = do { local $/; <$child_out> }; my $error = do { local $/; <$child_err> };