need to unregister an close all events (fixes "too many open files" error)
This commit is contained in:
parent
5a30d6e015
commit
b5406aa83b
|
@ -40,12 +40,16 @@ proc asyncExecCmd*(command: string): Future[string] =
|
|||
proc successCallback(fd: AsyncFD): bool =
|
||||
future.complete(^flowVar)
|
||||
successEvent.unregister()
|
||||
successEvent.close()
|
||||
failureEvent.unregister()
|
||||
failureEvent.close()
|
||||
true
|
||||
proc failureCallback(fd: AsyncFD): bool =
|
||||
future.fail(newException(OSError, ^flowVar))
|
||||
successEvent.unregister()
|
||||
successEvent.close()
|
||||
failureEvent.unregister()
|
||||
failureEvent.close()
|
||||
true
|
||||
addEvent(successEvent, successCallback)
|
||||
addEvent(failureEvent, failureCallback)
|
||||
|
|
Loading…
Reference in New Issue