summary refs log tree commit diff stats
path: root/lib/pure/osproc.nim
diff options
context:
space:
mode:
authorAraq <rumpf_a@web.de>2011-11-08 01:29:29 +0100
committerAraq <rumpf_a@web.de>2011-11-08 01:29:29 +0100
commit25e813b5d0be2b8ea377913d145b2a2ac891c4cb (patch)
treef8655bd33d919106449da501975ca2ce92753d6c /lib/pure/osproc.nim
parent0b4d5e45b9a6a78f1d661d119cd76f41fecaefea (diff)
downloadNim-25e813b5d0be2b8ea377913d145b2a2ac891c4cb.tar.gz
bugfixes for the tester; the tester now supports running of single tests
Diffstat (limited to 'lib/pure/osproc.nim')
-rwxr-xr-xlib/pure/osproc.nim12
1 files changed, 5 insertions, 7 deletions
diff --git a/lib/pure/osproc.nim b/lib/pure/osproc.nim
index dbf7b0e48..074700800 100755
--- a/lib/pure/osproc.nim
+++ b/lib/pure/osproc.nim
@@ -568,7 +568,7 @@ elif not defined(useNimRtl):
     if waitPid(p.id, p.exitCode, 0) < 0:
       p.exitCode = -3
       OSError()
-    result = int(p.exitCode)
+    result = int(p.exitCode) shr 8
 
   proc peekExitCode(p: PProcess): int =
     if p.exitCode != -3: return p.exitCode
@@ -576,7 +576,7 @@ elif not defined(useNimRtl):
     var b = ret == int(p.id)
     if b: result = -1
     if p.exitCode == -3: result = -1
-    else: result = p.exitCode
+    else: result = p.exitCode.int shr 8
 
   proc inputStream(p: PProcess): PStream =
     var f: TFile
@@ -641,14 +641,12 @@ proc execCmdEx*(command: string, options: set[TProcessOption] = {
   var p = startCmd(command, options)
   var outp = outputStream(p)
   result = (TaintedString"", -1)
-  while not outp.atEnd(outp):
+  while true:
+    result[1] = peekExitCode(p)
+    if result[1] != -1 and outp.atEnd(outp): break
     result[0].string.add(outp.readLine().string)
     result[0].string.add("\n")
-    result[1] = peekExitCode(p)
-    if result[1] != -1: break
   outp.close(outp)
-  if result[1] == -1:
-    result[1] = peekExitCode(p)
   close(p)