summary refs log tree commit diff stats
path: root/lib
diff options
context:
space:
mode:
authorJohannes Hofmann <johannes.hofmann@gmx.de>2016-09-30 10:19:57 +0200
committerJohannes Hofmann <johannes.hofmann@gmx.de>2016-09-30 10:19:57 +0200
commit52db21bb2cb03b498b0cb3b34a49213449b34b2e (patch)
treeb9d9566eef0b482b90cd5317cae05d033fc99db6 /lib
parent72ee6f78c5ae1d2eff406d3b39fd6820887e22ad (diff)
downloadNim-52db21bb2cb03b498b0cb3b34a49213449b34b2e.tar.gz
convert exitStatus to exit code
Diffstat (limited to 'lib')
-rw-r--r--lib/pure/osproc.nim6
1 files changed, 3 insertions, 3 deletions
diff --git a/lib/pure/osproc.nim b/lib/pure/osproc.nim
index be59de120..6c2debb1b 100644
--- a/lib/pure/osproc.nim
+++ b/lib/pure/osproc.nim
@@ -977,7 +977,7 @@ elif not defined(useNimRtl):
     import kqueue, times
 
     proc waitForExit(p: Process, timeout: int = -1): int =
-      if p.exitStatus != -3: return p.exitStatus
+      if p.exitStatus != -3: return int(p.exitStatus) shr 8
       if timeout == -1:
         var status : cint = 1
         if waitpid(p.id, status, 0) < 0:
@@ -1064,7 +1064,7 @@ elif not defined(useNimRtl):
       # ``waitPid`` fails if the process is not running anymore. But then
       # ``running`` probably set ``p.exitStatus`` for us. Since ``p.exitStatus`` is
       # initialized with -3, wrong success exit codes are prevented.
-      if p.exitStatus != -3: return p.exitStatus
+      if p.exitStatus != -3: return int(p.exitStatus) shr 8
       if timeout == -1:
         var status : cint = 1
         if waitpid(p.id, status, 0) < 0:
@@ -1142,7 +1142,7 @@ elif not defined(useNimRtl):
 
   proc peekExitCode(p: Process): int =
     var status : cint = 1
-    if p.exitStatus != -3: return p.exitStatus
+    if p.exitStatus != -3: return int(p.exitStatus) shr 8
     var ret = waitpid(p.id, status, WNOHANG)
     var b = ret == int(p.id)
     if b: result = -1