don't run afoul of pipe limits

This commit is contained in:
Mamy Ratsimbazafy 2022-09-19 01:47:18 +02:00
parent fb594c5938
commit 495d5fa9fd
No known key found for this signature in database
GPG Key ID: 6227262F49BE273A
1 changed files with 7 additions and 2 deletions

View File

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