diff options
author | Andreas Rumpf <rumpf_a@web.de> | 2019-05-29 15:59:11 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-05-29 15:59:11 +0200 |
commit | f79b6dee33c588bc4a046d0650e1b1302bfc2e40 (patch) | |
tree | 28beb4f99c3b16caf42c2f6ae9d1a881a6801ade | |
parent | d654383a8e5e871904194eec0cce78500e161872 (diff) | |
download | Nim-f79b6dee33c588bc4a046d0650e1b1302bfc2e40.tar.gz |
fixes excessive newlines in testament's output (#11351)
-rw-r--r-- | testament/tester.nim | 30 |
1 files changed, 18 insertions, 12 deletions
diff --git a/testament/tester.nim b/testament/tester.nim index bdf296bc6..1e5bc875a 100644 --- a/testament/tester.nim +++ b/testament/tester.nim @@ -146,16 +146,19 @@ proc callCompiler(cmdTemplate, filename, options: string, var tmpl = "" var x = newStringOfCap(120) result.nimout = "" - while outp.readLine(x.TaintedString) or running(p): - result.nimout.add(x & "\n") - if x =~ pegOfInterest: - # `err` should contain the last error/warning message - err = x - elif x =~ pegLineTemplate and err == "": - # `tmpl` contains the last template expansion before the error - tmpl = x - elif x =~ pegSuccess: - suc = x + while true: + if outp.readLine(x.TaintedString): + result.nimout.add(x & "\n") + if x =~ pegOfInterest: + # `err` should contain the last error/warning message + err = x + elif x =~ pegLineTemplate and err == "": + # `tmpl` contains the last template expansion before the error + tmpl = x + elif x =~ pegSuccess: + suc = x + elif not running(p): + break close(p) result.msg = "" result.file = "" @@ -193,8 +196,11 @@ proc callCCompiler(cmdTemplate, filename, options: string, result.file = "" result.output = "" result.line = -1 - while outp.readLine(x.TaintedString) or running(p): - result.nimout.add(x & "\n") + while true: + if outp.readLine(x.TaintedString): + result.nimout.add(x & "\n") + elif not running(p): + break close(p) if p.peekExitCode == 0: result.err = reSuccess |