Sends a posix signal to the process.
integer $signal A valid posix signal (see http://www.php.net/manual/en/pcntl.constants.php):
LogicException In case the process is not running
RuntimeException In case --enable-sigchild is activated
RuntimeException In case of failure
public function signal($signal) {
if (!$this
->isRunning()) {
throw new LogicException('Can not send signal on a non running process.');
}
if ($this
->isSigchildEnabled()) {
throw new RuntimeException('This PHP has been compiled with --enable-sigchild. The process can not be signaled.');
}
if (true !== @proc_terminate($this->process, $signal)) {
throw new RuntimeException(sprintf('Error while sending signal `%d`.', $signal));
}
return $this;
}