try to fix "too many open files" error
This commit is contained in:
parent
f1d917d49e
commit
5a30d6e015
|
@ -39,9 +39,13 @@ proc asyncExecCmd*(command: string): Future[string] =
|
|||
let flowVar = spawn execCmdBackground(successEvent, failureEvent, command)
|
||||
proc successCallback(fd: AsyncFD): bool =
|
||||
future.complete(^flowVar)
|
||||
successEvent.unregister()
|
||||
failureEvent.unregister()
|
||||
true
|
||||
proc failureCallback(fd: AsyncFD): bool =
|
||||
future.fail(newException(OSError, ^flowVar))
|
||||
successEvent.unregister()
|
||||
failureEvent.unregister()
|
||||
true
|
||||
addEvent(successEvent, successCallback)
|
||||
addEvent(failureEvent, failureCallback)
|
||||
|
|
Loading…
Reference in New Issue