Skip to content

Commit a480bf8

Browse files
dktappscmb69
authored andcommitted
Capture Microsoft-defined HRESULT exit codes exit codes
The lack of such a check leads to false-passes of tests on Windows which expect no output, but produce a segfault or similar issue. I discovered this a while ago due to bad tests in an extension I maintain. Closes phpGH-6722.
1 parent 8309c04 commit a480bf8

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

run-tests.php

+3
Original file line numberDiff line numberDiff line change
@@ -1273,6 +1273,9 @@ function system_with_timeout($commandline, $env = null, $stdin = null, $captureS
12731273
}
12741274
if ($stat["exitcode"] > 128 && $stat["exitcode"] < 160) {
12751275
$data .= "\nTermsig=" . ($stat["exitcode"] - 128) . "\n";
1276+
} else if (defined('PHP_WINDOWS_VERSION_MAJOR') && (($stat["exitcode"] >> 28) & 0b1111) === 0b1100) {
1277+
// https://docs.microsoft.com/en-us/openspecs/windows_protocols/ms-erref/87fba13e-bf06-450e-83b1-9241dc81e781
1278+
$data .= "\nTermsig=" . $stat["exitcode"] . "\n";
12761279
}
12771280

12781281
proc_close($proc);

0 commit comments

Comments
 (0)