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