This commit is contained in:
Daylin Morgan 2024-09-05 10:17:36 -05:00
parent 46912c29af
commit b83c345693
Signed by: daylin
GPG key ID: 950D13E9719334AD

View file

@ -24,26 +24,26 @@ proc runCmdCapt*(cmd: string): tuple[stdout, stderr: string, exitCode: int] =
options = {poUsePath} options = {poUsePath}
) )
p.inputStream.close() p.inputStream.close()
let ostrm = outputStream p let outstrm = outputStream p
let errstrm = errorStream p let errstrm = errorStream p
result.exitCode = -1 # result.exitCode = -1
var line: string # var line: string
var cnt: int # var cnt: int
while true: # while true:
echo cnt # echo cnt
if ostrm.readLine(line): # if outstrm.readLine(line):
result.stdout.add line & '\n' # result.stdout.add line & '\n'
if errstrm.readLine(line): # if errstrm.readLine(line):
result.stderr.add line & '\n' # result.stderr.add line & '\n'
result.exitCode = peekExitCode(p) # result.exitCode = peekExitCode(p)
if result.exitCode != -1: break # if result.exitCode != -1: break
inc cnt # inc cnt
echo "process should have started?"
# result = ( result = (
# readAll p.outputStream, readAll outstrm,
# readAll p.errorStream, readAll errstrm,
# waitForExit p waitForExit p
# ) )
close p close p
proc runCmdCaptWithSpinner*(cmd: string, msg: string = ""): tuple[output, err: string] = proc runCmdCaptWithSpinner*(cmd: string, msg: string = ""): tuple[output, err: string] =