diff --git a/src/ContextInterface.php b/src/ContextInterface.php index cbfdef6..d038059 100644 --- a/src/ContextInterface.php +++ b/src/ContextInterface.php @@ -1,7 +1,7 @@ channel = null; } + /** + * @param int $signo + * + * @throws \Icicle\Concurrent\Exception\StatusError + */ + public function signal($signo) + { + if (0 === $this->pid) { + throw new StatusError('The fork has not been started or has already finished.'); + } + + posix_kill($this->pid, (int) $signo); + } + /** * @coroutine * diff --git a/src/Process/ChannelledProcess.php b/src/Process/ChannelledProcess.php index 044a524..d0cbfc4 100644 --- a/src/Process/ChannelledProcess.php +++ b/src/Process/ChannelledProcess.php @@ -1,14 +1,15 @@ process->kill(); $this->channel = null; } + + /** + * {@inheritdoc} + */ + public function getPid() + { + return $this->process->getPid(); + } + + /** + * {@inheritdoc} + */ + public function signal($signo) + { + $this->process->signal($signo); + } } diff --git a/src/Process/Process.php b/src/Process/Process.php index 0721b88..e36d2ef 100644 --- a/src/Process/Process.php +++ b/src/Process/Process.php @@ -1,15 +1,15 @@