From 1dccbaf9a0cc0256701cfbae5bbb17b4d4e9416a Mon Sep 17 00:00:00 2001 From: Johannes Hofmann Date: Sun, 25 Sep 2016 10:16:14 +0200 Subject: [PATCH] another attempt at properly declaring the status variable --- lib/pure/osproc.nim | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/lib/pure/osproc.nim b/lib/pure/osproc.nim index bd0f122f34..be59de1206 100644 --- a/lib/pure/osproc.nim +++ b/lib/pure/osproc.nim @@ -1039,7 +1039,6 @@ elif not defined(useNimRtl): template adjustTimeout(t, s, e: Timespec) = var diff: int var b: Timespec - var status : cint = 1 b.tv_sec = e.tv_sec b.tv_nsec = e.tv_nsec e.tv_sec = (e.tv_sec - s.tv_sec).Time @@ -1067,6 +1066,7 @@ elif not defined(useNimRtl): # initialized with -3, wrong success exit codes are prevented. if p.exitStatus != -3: return p.exitStatus if timeout == -1: + var status : cint = 1 if waitpid(p.id, status, 0) < 0: raiseOSError(osLastError()) p.exitStatus = status @@ -1100,6 +1100,7 @@ elif not defined(useNimRtl): let res = sigtimedwait(nmask, sinfo, tmspec) if res == SIGCHLD: if sinfo.si_pid == p.id: + var status : cint = 1 if waitpid(p.id, status, 0) < 0: raiseOSError(osLastError()) p.exitStatus = status @@ -1122,6 +1123,7 @@ elif not defined(useNimRtl): # timeout expired, so we trying to kill process if posix.kill(p.id, SIGKILL) == -1: raiseOSError(osLastError()) + var status : cint = 1 if waitpid(p.id, status, 0) < 0: raiseOSError(osLastError()) p.exitStatus = status