From 74a6a2e25c11d2b7b6db8efa0257119f6df7deda Mon Sep 17 00:00:00 2001 From: Daylin Morgan Date: Thu, 23 Jan 2025 11:41:29 -0600 Subject: [PATCH] fix stdout/stderr formatting --- pkgs/oizys/src/oizys/exec.nim | 25 ++++++++++--------------- 1 file changed, 10 insertions(+), 15 deletions(-) diff --git a/pkgs/oizys/src/oizys/exec.nim b/pkgs/oizys/src/oizys/exec.nim index 3c6fe96..9c5cc94 100644 --- a/pkgs/oizys/src/oizys/exec.nim +++ b/pkgs/oizys/src/oizys/exec.nim @@ -57,21 +57,16 @@ proc runCmdCapt*( close p proc formatStdoutStderr(stdout: string, stderr: string): string = - template addLine = - # TODO: make -> red after hwylterm update - result.add "-> " - result.add line - result.add "\n" - - result.add "stdout:\n" - for line in stdout.splitLines(): - addLine - - result.add "stdout:\n" - for line in stderr.splitLines(): - addLine - - + template show(stream: string) = + if stream.strip() != "": + result.add astToStr(stream) & ":\n" + for line in stream.splitlines(): + # TODO: make -> red after hwylterm update + result.add "-> " + result.add line + result.add "\n" + show(stdout) + show(stderr) proc runCmdCaptWithSpinner*( cmd: string,