From 458e3b2f07eea9a1f6d369cb10e7504f4e4d3855 Mon Sep 17 00:00:00 2001 From: modk Date: Thu, 29 Jan 2015 12:51:22 +0100 Subject: [PATCH] FreeBSD-specific code --- lib/pure/osproc.nim | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/lib/pure/osproc.nim b/lib/pure/osproc.nim index 7261dcf562..6361dfb092 100644 --- a/lib/pure/osproc.nim +++ b/lib/pure/osproc.nim @@ -848,10 +848,14 @@ elif not defined(useNimRtl): if kill(p.id, SIGCONT) != 0'i32: raiseOsError(osLastError()) proc running(p: Process): bool = - var status : cint = 1 - var ret = waitpid(p.id, status, WNOHANG) - if WIFEXITED(status): - p.exitCode = status + var ret : int + when not defined(freebsd): + ret = waitpid(p.id, p.exitCode, WNOHANG) + else: + var status : cint = 1 + ret = waitpid(p.id, status, WNOHANG) + if WIFEXITED(status): + p.exitCode = status if ret == 0: return true # Can't establish status. Assume running. result = ret == int(p.id)