Fix #14289 (#14304) [backport]

This commit is contained in:
slangmgh 2020-05-12 01:17:37 +08:00 • committed by GitHub
commit 76f7e95814
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

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)))