diff --git a/asyncutils.nim b/asyncutils.nim index 51baf95..02bf50d 100644 --- a/asyncutils.nim +++ b/asyncutils.nim @@ -34,8 +34,10 @@ proc asyncExecCmd*(command: string): Future[string] = (result, exitCode) = execCmdEx(command) if exitCode != 0: failureEvent.trigger() + successEvent.unregister() else: successEvent.trigger() + failureEvent.unregister() let flowVar = spawn execCmdBackground(successEvent, failureEvent, command) proc successCallback(fd: AsyncFD): bool = future.complete(^flowVar)