reset p.exitCode in peekExitCode on Posix when process did not exit (#4793)

* reset p.exitCode in peekExitCode on Posix when process did not exit

fixes #4792

* fix indentation
This commit is contained in:
Johannes Hofmann 2016-09-17 22:03:14 +02:00 • committed by Dominik Picheta
commit 93160547a9

View file

@ -1143,7 +1143,9 @@ elif not defined(useNimRtl):
var ret = waitpid(p.id, p.exitCode, WNOHANG) var ret = waitpid(p.id, p.exitCode, WNOHANG)
var b = ret == int(p.id) var b = ret == int(p.id)
if b: result = -1 if b: result = -1
if not WIFEXITED(p.exitCode): result = -1 if not WIFEXITED(p.exitCode):
p.exitCode = -3
result = -1
else: result = p.exitCode.int shr 8 else: result = p.exitCode.int shr 8
proc createStream(stream: var Stream, handle: var FileHandle, proc createStream(stream: var Stream, handle: var FileHandle,