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 =
|
proc successCallback(fd: AsyncFD): bool =
|
||||||
future.complete(^flowVar)
|
future.complete(^flowVar)
|
||||||
successEvent.unregister()
|
successEvent.unregister()
|
||||||
|
successEvent.close()
|
||||||
failureEvent.unregister()
|
failureEvent.unregister()
|
||||||
|
failureEvent.close()
|
||||||
true
|
true
|
||||||
proc failureCallback(fd: AsyncFD): bool =
|
proc failureCallback(fd: AsyncFD): bool =
|
||||||
future.fail(newException(OSError, ^flowVar))
|
future.fail(newException(OSError, ^flowVar))
|
||||||
successEvent.unregister()
|
successEvent.unregister()
|
||||||
|
successEvent.close()
|
||||||
failureEvent.unregister()
|
failureEvent.unregister()
|
||||||
|
failureEvent.close()
|
||||||
true
|
true
|
||||||
addEvent(successEvent, successCallback)
|
addEvent(successEvent, successCallback)
|
||||||
addEvent(failureEvent, failureCallback)
|
addEvent(failureEvent, failureCallback)
|
||||||
|
|
Loading…
Reference in New Issue