From 495d5fa9fd60e719174d3adec1627e9fc727b3a9 Mon Sep 17 00:00:00 2001 From: Mamy Ratsimbazafy Date: Mon, 19 Sep 2022 01:47:18 +0200 Subject: [PATCH] don't run afoul of pipe limits --- helpers/pararun.nim | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/helpers/pararun.nim b/helpers/pararun.nim index a06116b..6947784 100644 --- a/helpers/pararun.nim +++ b/helpers/pararun.nim @@ -99,10 +99,15 @@ proc flushCommandsOutput(wq: WorkQueue) {.async.} = let charsWritten = stdout.writeBuffer(wq.lineBuf[0].addr, charsRead) doAssert charsRead == charsWritten - let exitCode = p.peekExitCode() + let exitCode = await p.waitForExit() if exitCode != 0: - quit "Command #" & $id & "exited with error " & $exitCode, exitCode + quit "Command #" & $id & " exited with error " & $exitCode, exitCode + # p.close() is not exposed :/ + p.inputHandle.close() + p.outputHandle.close() + p.errorHandle.close() + id += 1 if wq.cmdQueue.len == 0 and wq.outputQueue.len == 0: