Fix #14289 (#14304) [backport]

This commit is contained in:
slangmgh
2020-05-12 01:17:37 +08:00
committed by GitHub
parent 0f344a70c9
commit 76f7e95814

View File

@@ -1000,10 +1000,11 @@ when defined(windows) or defined(nimdoc):
proc addProcess*(pid: int, cb: Callback) =
## Registers callback ``cb`` to be called when process with process ID
## ``pid`` exited.
const NULL = Handle(0)
let p = getGlobalDispatcher()
let procFlags = SYNCHRONIZE
var hProcess = openProcess(procFlags, 0, pid.DWORD)
if hProcess == INVALID_HANDLE_VALUE:
if hProcess == NULL:
raiseOSError(osLastError())
var pcd = cast[PostCallbackDataPtr](allocShared0(sizeof(PostCallbackData)))