summary refs log tree commit diff stats
diff options
context:
space:
mode:
-rw-r--r--lib/pure/osproc.nim2
1 files changed, 2 insertions, 0 deletions
diff --git a/lib/pure/osproc.nim b/lib/pure/osproc.nim
index 07429b9a9..15ffbf5de 100644
--- a/lib/pure/osproc.nim
+++ b/lib/pure/osproc.nim
@@ -617,6 +617,7 @@ when defined(Windows) and not defined(useNimRtl):
     var res: int32
     discard getExitCodeProcess(p.fProcessHandle, res)
     result = res
+    p.exitStatus = res
     discard closeHandle(p.fProcessHandle)
 
   proc peekExitCode(p: Process): int =
@@ -625,6 +626,7 @@ when defined(Windows) and not defined(useNimRtl):
     else:
       var res: int32
       discard getExitCodeProcess(p.fProcessHandle, res)
+      if res == 0: return p.exitStatus
       return res
 
   proc inputStream(p: Process): Stream =