Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit ec6ba19

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/[email protected]
1 parent 8f5d4ee commit ec6ba19

File tree

1 file changed

+4
-8
lines changed

1 file changed

+4
-8
lines changed

src/test/perl/TestLib.pm

+4-8
Original file line numberDiff line numberDiff line change
@@ -354,15 +354,11 @@ sub command_exit_is
354354
my $h = IPC::Run::start $cmd;
355355
$h->finish();
356356

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

0 commit comments

Comments
 (0)