You are here

private function Process::doSignal in Zircon Profile 8

Same name and namespace in other branches
  1. 8.0 vendor/symfony/process/Process.php \Symfony\Component\Process\Process::doSignal()

Sends a POSIX signal to the process.

Parameters

int $signal A valid POSIX signal (see http://www.php.net/manual/en/pcntl.constants.php):

bool $throwException Whether to throw exception in case signal failed:

Return value

bool True if the signal was sent successfully, false otherwise

Throws

LogicException In case the process is not running

RuntimeException In case --enable-sigchild is activated

RuntimeException In case of failure

2 calls to Process::doSignal()
Process::signal in vendor/symfony/process/Process.php
Sends a POSIX signal to the process.
Process::stop in vendor/symfony/process/Process.php
Stops the process.

File

vendor/symfony/process/Process.php, line 1446

Class

Process
Process is a thin wrapper around proc_* functions to easily start independent PHP processes.

Namespace

Symfony\Component\Process

Code

private function doSignal($signal, $throwException) {
  if (!$this
    ->isRunning()) {
    if ($throwException) {
      throw new LogicException('Can not send signal on a non running process.');
    }
    return false;
  }
  if ($this
    ->isSigchildEnabled()) {
    if ($throwException) {
      throw new RuntimeException('This PHP has been compiled with --enable-sigchild. The process can not be signaled.');
    }
    return false;
  }
  if (true !== @proc_terminate($this->process, $signal)) {
    if ($throwException) {
      throw new RuntimeException(sprintf('Error while sending signal `%s`.', $signal));
    }
    return false;
  }
  $this->latestSignal = $signal;
  return true;
}