just close it earlier

This commit is contained in:
Daylin Morgan 2024-09-05 11:10:41 -05:00
parent c55dd04671
commit a5668d426d
Signed by: daylin
GPG key ID: 950D13E9719334AD

View file

@ -23,7 +23,6 @@ proc runCmdCapt*(cmd: string): tuple[stdout, stderr: string, exitCode: int] =
args = args[1..^1],
options = {poUsePath}
)
p.inputStream.close()
let outstrm = outputStream p
let errstrm = errorStream p
# result.exitCode = -1
@ -40,13 +39,14 @@ proc runCmdCapt*(cmd: string): tuple[stdout, stderr: string, exitCode: int] =
# inc cnt
echo "process should have started?"
echo p.running, "<--running?"
close p
result = (
readAll outstrm,
readAll errstrm,
-1,
)
result.exitCode = waitForExit p
close p
# result.exitCode = waitForExit p
# close p
proc runCmdCaptWithSpinner*(cmd: string, msg: string = ""): tuple[output, err: string] =
debug fmt"running command: {cmd}"