Skip to content

Commit 7298b90

Browse files
committed
Account for IPC::Run::result() Windows behavior change.
This restores compatibility with the not-yet-released successor of version 20220807.0. Back-patch to 9.4, which introduced this code. Reviewed by Andrew Dunstan. Discussion: https://postgr.es/m/20221117061805.GA4020280@rfd.leadboat.com
1 parent b2b9881 commit 7298b90

File tree

1 file changed

+4
-8
lines changed

1 file changed

+4
-8
lines changed

src/test/perl/TestLib.pm

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -298,15 +298,11 @@ sub command_exit_is
298298
my $h = IPC::Run::start $cmd;
299299
$h->finish();
300300

301-
# On Windows, the exit status of the process is returned directly as the
302-
# process's exit code, while on Unix, it's returned in the high bits
303-
# of the exit code (see WEXITSTATUS macro in the standard <sys/wait.h>
304-
# header file). IPC::Run's result function always returns exit code >> 8,
305-
# assuming the Unix convention, which will always return 0 on Windows as
306-
# long as the process was not terminated by an exception. To work around
307-
# that, use $h->full_result on Windows instead.
301+
# Normally, if the child called exit(N), IPC::Run::result() returns N. On
302+
# Windows, with IPC::Run v20220807.0 and earlier, full_results() is the
303+
# method that returns N (https://github.com/toddr/IPC-Run/issues/161).
308304
my $result =
309-
($Config{osname} eq "MSWin32")
305+
($Config{osname} eq "MSWin32" && $IPC::Run::VERSION <= 20220807.0)
310306
? ($h->full_results)[0]
311307
: $h->result(0);
312308
is($result, $expected, $test_name);

0 commit comments

Comments
 (0)