Double check before throwing an exception. (#4790)

Since we are running two processes, we could leak one if we throw an exception and execution stops.
This commit is contained in:
Tony Murray
2016-10-15 12:21:46 -05:00
committed by Neil Lathwood
parent 87ff439d8f
commit da0d04a5b6

View File

@@ -197,11 +197,10 @@ class Proc
if (!$closed) {
// try harder
$pid = $status['pid'];
$killed = posix_kill($pid, 9); //9 is the SIGKILL signal
$killed = posix_kill($status['pid'], 9); //9 is the SIGKILL signal
proc_close($this->_process);
if (!$killed) {
if (!$killed && $this->isRunning()) {
throw new Exception("Terminate failed!");
}
}