diff --git a/asyncprocmonitor.nim b/asyncprocmonitor.nim index 4eef7b9..64073f3 100644 --- a/asyncprocmonitor.nim +++ b/asyncprocmonitor.nim @@ -1,7 +1,7 @@ # Monitor a client process and shutdown the current process, if the client # process is found to be dead -import os, chronos, utils +import os, chronos, utils, sugar when defined(posix): import posix_utils @@ -12,11 +12,10 @@ type Callback* = proc() {.closure, gcsafe, raises: [].} when defined(windows): import winlean -when defined(windows): - proc hookAsyncProcMonitor*(pid: int, cb: Callback) = - addProcess(pid, cb) + proc hookAsyncProcMonitor*(pid: int, cb: Callback) = discard + addProcess2(pid, (arg: pointer) => cb()) -when defined(posix): +elif defined(posix): proc hookAsyncProcMonitor*(pid: int, cb: Callback) = var processExitCallbackCalled = false