convert exitStatus to exit code
This commit is contained in:
parent
72ee6f78c5
commit
52db21bb2c
1 changed files with 3 additions and 3 deletions
|
|
@ -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
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue