mirror of
https://github.com/nim-lang/Nim.git
synced 2026-01-07 21:43:33 +00:00
Fix a bug with starting of asynchronous processes (#18464)
The asynchronous process completion handler callback should be called only once. This is achieved by passing `WT_EXECUTEONLYONCE` flag to the `registerWaitForSingleObject` Windows API procedure. Related to cheatfate/asynctools#35
This commit is contained in:
@@ -1022,7 +1022,7 @@ when defined(windows) or defined(nimdoc):
|
||||
raiseOSError(osLastError())
|
||||
|
||||
var pcd = cast[PostCallbackDataPtr](allocShared0(sizeof(PostCallbackData)))
|
||||
var flags = WT_EXECUTEINWAITTHREAD.DWORD
|
||||
var flags = WT_EXECUTEINWAITTHREAD.DWORD or WT_EXECUTEONLYONCE.DWORD
|
||||
|
||||
proc proccb(fd: AsyncFD, bytesCount: DWORD, errcode: OSErrorCode) =
|
||||
closeWaitable(hProcess)
|
||||
|
||||
Reference in New Issue
Block a user