File tree Expand file tree Collapse file tree 1 file changed +5
-1
lines changed
Expand file tree Collapse file tree 1 file changed +5
-1
lines changed Original file line number Diff line number Diff line change @@ -2815,6 +2815,10 @@ void kill(Pid pid, int codeOrSignal)
28152815 else version (Posix )
28162816 {
28172817 import core.sys.posix.signal : kill;
2818+ if (pid.osHandle == Pid.invalid)
2819+ throw new ProcessException (" Pid is invalid" );
2820+ if (pid.osHandle == Pid.terminated)
2821+ throw new ProcessException (" Pid is already terminated" );
28182822 if (kill(pid.osHandle, codeOrSignal) == - 1 )
28192823 throw ProcessException .newFromErrno();
28202824 }
@@ -2856,7 +2860,7 @@ void kill(Pid pid, int codeOrSignal)
28562860 do { s = tryWait(pid); } while (! s.terminated);
28572861 version (Windows ) assert (s.status == 123 );
28582862 else version (Posix ) assert (s.status == - SIGKILL );
2859- assertThrown! ProcessException (kill(pid));
2863+ assertThrown! ProcessException (kill(pid)); // Already terminated
28602864}
28612865
28622866@system unittest // wait() and kill() detached process
You can’t perform that action at this time.
0 commit comments