diff options
author | Noah Misch <noah@leadboat.com> | 2022-11-17 07:35:06 -0800 |
---|---|---|
committer | Noah Misch <noah@leadboat.com> | 2022-11-17 07:35:06 -0800 |
commit | aca93b5f189abe3b862761bf96811b2facf35555 (patch) | |
tree | 82a8d87c32d4badc8d98b71c4ab87e6526b6b560 /src/test/perl/PostgreSQL/Test | |
parent | bbf9c282ce92272ed7bf6771daf0f9efa209e61b (diff) | |
download | postgresql-aca93b5f189abe3b862761bf96811b2facf35555.tar.gz postgresql-aca93b5f189abe3b862761bf96811b2facf35555.zip |
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
Diffstat (limited to 'src/test/perl/PostgreSQL/Test')
-rw-r--r-- | src/test/perl/PostgreSQL/Test/Utils.pm | 12 |
1 files changed, 4 insertions, 8 deletions
diff --git a/src/test/perl/PostgreSQL/Test/Utils.pm b/src/test/perl/PostgreSQL/Test/Utils.pm index 99d33451064..b139190cc88 100644 --- a/src/test/perl/PostgreSQL/Test/Utils.pm +++ b/src/test/perl/PostgreSQL/Test/Utils.pm @@ -782,15 +782,11 @@ sub command_exit_is my $h = IPC::Run::start $cmd; $h->finish(); - # On Windows, the exit status of the process is returned directly as the - # process's exit code, while on Unix, it's returned in the high bits - # of the exit code (see WEXITSTATUS macro in the standard <sys/wait.h> - # header file). IPC::Run's result function always returns exit code >> 8, - # assuming the Unix convention, which will always return 0 on Windows as - # long as the process was not terminated by an exception. To work around - # that, use $h->full_results on Windows instead. + # Normally, if the child called exit(N), IPC::Run::result() returns N. On + # Windows, with IPC::Run v20220807.0 and earlier, full_results() is the + # method that returns N (https://github.com/toddr/IPC-Run/issues/161). my $result = - ($Config{osname} eq "MSWin32") + ($Config{osname} eq "MSWin32" && $IPC::Run::VERSION <= 20220807.0) ? ($h->full_results)[0] : $h->result(0); is($result, $expected, $test_name); |