From 5a954a92bf9527cb67755244253223859b950663 Mon Sep 17 00:00:00 2001 From: Daylin Morgan Date: Tue, 11 Feb 2025 12:58:30 -0600 Subject: [PATCH] try atEnd? --- pkgs/oizys/src/oizys/exec.nim | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/pkgs/oizys/src/oizys/exec.nim b/pkgs/oizys/src/oizys/exec.nim index 4ae5540..db2a397 100644 --- a/pkgs/oizys/src/oizys/exec.nim +++ b/pkgs/oizys/src/oizys/exec.nim @@ -45,11 +45,12 @@ proc runCmdCapt*( errstrm = peekableErrorStream p result.exitCode = -1 var line: string + # BUG: the readLine's hang if there is no data. would peek also hang? while true: - if CaptStdout in capture and not isNil(outstrm): + if CaptStdout in capture and not outstrm.atEnd(): if outstrm.readLine(line): result.stdout.add line & '\n' - if CaptStderr in capture and not isNil(errstrm): + if CaptStderr in capture and not errstrm.atEnd(): if errstrm.readLine(line): result.stderr.add line & '\n' result.exitCode = peekExitCode(p)