diff --git a/src/nimblepkg/tools.nim b/src/nimblepkg/tools.nim index 3bd0365..29fbf5d 100644 --- a/src/nimblepkg/tools.nim +++ b/src/nimblepkg/tools.nim @@ -21,18 +21,22 @@ proc doCmd*(cmd: string, showOutput = false) = stderr.flushFile() displayDebug("Executing", cmd) - let (output, exitCode) = execCmdEx(cmd) - displayDebug("Finished", "with exit code " & $exitCode) - # TODO: Improve to show output in real-time. if showOutput: - display("Output:", output, priority = HighPriority) + let exitCode = execCmd(cmd) + displayDebug("Finished", "with exit code " & $exitCode) + if exitCode != QuitSuccess: + raise newException(NimbleError, + "Execution failed with exit code $1\nCommand: $2" % + [$exitCode, cmd]) else: + let (output, exitCode) = execCmdEx(cmd) + displayDebug("Finished", "with exit code " & $exitCode) displayDebug("Output", output) - if exitCode != QuitSuccess: - raise newException(NimbleError, - "Execution failed with exit code $1\nCommand: $2\nOutput: $3" % - [$exitCode, cmd, output]) + if exitCode != QuitSuccess: + raise newException(NimbleError, + "Execution failed with exit code $1\nCommand: $2\nOutput: $3" % + [$exitCode, cmd, output]) proc doCmdEx*(cmd: string): tuple[output: TaintedString, exitCode: int] = let bin = extractBin(cmd) diff --git a/tests/tester.nim b/tests/tester.nim index 02a4843..6749927 100644 --- a/tests/tester.nim +++ b/tests/tester.nim @@ -194,7 +194,7 @@ test "can use nimscript's setCommand with flags": let (output, exitCode) = execNimble("--debug", "cr") let lines = output.strip.splitLines() check exitCode == QuitSuccess - check "Hello World".normalize in lines[^2].normalize + check inLines(lines, "Hello World") test "can use nimscript with repeated flags (issue #329)": cd "nimscript":