8000 Account for IPC::Run::result() Windows behavior change. · postgres/postgres@791dd75 · GitHub
[go: up one dir, main page]

Skip to content

Commit 791dd75

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 1703033 commit 791dd75

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
@@ -490,15 +490,11 @@ sub command_exit_is
490490
my $h = IPC::Run::start $cmd;
491491
$h->finish();
492492

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

0 commit comments

Comments
 (0)
0