Skip to content

Commit 1af28b2

Browse files
authored
Merge pull request #3122 from compnerd/hresult-5.6
Process: handle `HRESULT` exit codes properly
2 parents 3cc5ec3 + a8550d0 commit 1af28b2

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

Sources/Foundation/Process.swift

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -631,8 +631,9 @@ open class Process: NSObject {
631631
// 3 to be an abnormal exit.
632632
var dwExitCode: DWORD = 0
633633
GetExitCodeProcess(process.processHandle, &dwExitCode)
634-
if (dwExitCode & 0xF0000000) == 0xC0000000
635-
|| (dwExitCode & 0xF0000000) == 0xE0000000
634+
if (dwExitCode & 0xF0000000) == 0x80000000 // HRESULT
635+
|| (dwExitCode & 0xF0000000) == 0xC0000000 // NTSTATUS
636+
|| (dwExitCode & 0xF0000000) == 0xE0000000 // NTSTATUS (Customer)
636637
|| dwExitCode == 3 {
637638
process._terminationStatus = Int32(dwExitCode & 0x3FFFFFFF)
638639
process._terminationReason = .uncaughtSignal

0 commit comments

Comments
 (0)