/** * Closes channel and socket if still open. */ private function close() { if (null !== $this->pipe && $this->pipe->isOpen()) { $this->pipe->close(); } if (is_resource($this->socket)) { fclose($this->socket); } $this->thread = null; $this->channel = null; }
/** * {@inheritdoc} */ public function kill() { if ($this->isRunning()) { // Forcefully kill the process using SIGKILL. posix_kill($this->pid, SIGKILL); } if (null !== $this->pipe && $this->pipe->isOpen()) { $this->pipe->close(); } // "Detach" from the process and let it die asynchronously. $this->pid = 0; $this->channel = null; }