Fixes to support Dragonfly BSD. (#5552)

* Fix kqueue.nim and ansi_c.nim to support dragonfly.
* Fix ioselectors.nim, threads.nim to support dragonfly.
* Fix deprecated dealloc call in tioselectors.nim.
* Fix tfsmonitor.nim test to run only on Linux.
* Fix osproc.nim return wrong exit codes.
* Fix getAppFilename() for dragonfly.
* Fix proper exit code handling.
This commit is contained in:
Eugene Kabanov 2017-03-17 09:22:11 +02:00 • committed by Andreas Rumpf
commit 336a7c9b3f
9 changed files with 39 additions and 20 deletions

View file

@ -990,7 +990,7 @@ elif not defined(useNimRtl):
import kqueue, times
proc waitForExit(p: Process, timeout: int = -1): int =
if p.exitStatus != -3: return int(p.exitStatus) shr 8
if p.exitStatus != -3: return ((p.exitStatus and 0xFF00) shr 8)
if timeout == -1:
var status : cint = 1
if waitpid(p.id, status, 0) < 0:
@ -1155,13 +1155,13 @@ elif not defined(useNimRtl):
proc peekExitCode(p: Process): int =
var status : cint = 1
if p.exitStatus != -3: return int(p.exitStatus) shr 8
if p.exitStatus != -3: return ((p.exitStatus and 0xFF00) shr 8)
var ret = waitpid(p.id, status, WNOHANG)
var b = ret == int(p.id)
if b: result = -1
if WIFEXITED(status):
p.exitStatus = status
result = p.exitStatus.int shr 8
result = (status and 0xFF00) shr 8
else:
result = -1