Skip to content

Commit 877cfeb

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 40064e1 commit 877cfeb

File tree

1 file changed

+7
-9
lines changed

1 file changed

+7
-9
lines changed

src/test/perl/TestLib.pm

Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -365,15 +365,13 @@ sub command_exit_is
365365
my $h = start $cmd;
366366
$h->finish();
367367

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

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy