diff --git a/source/eventcore/drivers/posix/processes.d b/source/eventcore/drivers/posix/processes.d index d2ac0cfd..2781b1f8 100644 --- a/source/eventcore/drivers/posix/processes.d +++ b/source/eventcore/drivers/posix/processes.d @@ -158,7 +158,10 @@ final class PosixEventDriverProcesses(Loop : PosixEventLoop) : EventDriverProces @trusted { import core.sys.posix.signal : pkill = kill; - pkill(cast(int)pid, signal); + assert(cast(int)pid > 0, "Invalid PID passed to kill."); + + if (cast(int)pid > 0) + pkill(cast(int)pid, signal); } final override size_t wait(ProcessID pid, ProcessWaitCallback on_process_exit)