Skip to content

Commit

Permalink
Ensure that a valid PID is passed to kill().
Browse files Browse the repository at this point in the history
  • Loading branch information
s-ludwig committed Aug 23, 2019
1 parent 01c2c26 commit 5c3afcc
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion source/eventcore/drivers/posix/processes.d
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down

0 comments on commit 5c3afcc

Please sign in to comment.