try to fix "too many open files" error

master
Christian Ulrich 2020-10-05 18:27:00 +02:00
parent f1d917d49e
commit 5a30d6e015
No known key found for this signature in database
GPG Key ID: 8241BE099775A097
1 changed files with 4 additions and 0 deletions

View File

@ -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)