Ensure that a valid PID is passed to kill().

This commit is contained in:
Sönke Ludwig 2019-08-22 14:35:37 +02:00 committed by Sönke Ludwig
parent 01c2c26964
commit 5c3afcc175

View file

@ -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)