original_string: private function doSignal(int $signal, bool $throwException): bool
      {
          if (null === $pid = $this->getPid()) {
              if ($throwException) {
                  throw new LogicException('Can not send signal on a non running process.');
              }
  
              return false;
          }
  
          if ('\\' === \DIRECTORY_SEPARATOR) {
              exec(sprintf('taskkill /F /T /PID %d 2>&1', $pid), $output, $exitCode);
              if ($exitCode && $this->isRunning()) {
                  if ($throwException) {
                      throw new RuntimeException(sprintf('Unable to kill the process (%s).', implode(' ', $output)));
                  }
  
                  return false;
              }
          } else {
              if (!$this->isSigchildEnabled()) {
                  $ok = @proc_terminate($this->process, $signal);
              } elseif (\function_exists('posix_kill')) {
                  $ok = @posix_kill($pid, $signal);
              } elseif ($ok = proc_open(sprintf('kill -%d %d', $signal, $pid), [2 => ['pipe', 'w']], $pipes)) {
                  $ok = false === fgets($pipes[2]);
              }
              if (!$ok) {
                  if ($throwException) {
                      throw new RuntimeException(sprintf('Error while sending signal "%s".', $signal));
                  }
  
                  return false;
              }
          }
  
          $this->latestSignal = $signal;
          $this->fallbackStatus['signaled'] = true;
          $this->fallbackStatus['exitcode'] = -1;
          $this->fallbackStatus['termsig'] = $this->latestSignal;
  
          return true;
      }
code: private function doSignal(int $signal, bool $throwException): bool
      {
          if (null === $pid = $this->getPid()) {
              if ($throwException) {
                  throw new LogicException('Can not send signal on a non running process.');
              }
  
              return false;
          }
  
          if ('\\' === \DIRECTORY_SEPARATOR) {
              exec(sprintf('taskkill /F /T /PID %d 2>&1', $pid), $output, $exitCode);
              if ($exitCode && $this->isRunning()) {
                  if ($throwException) {
                      throw new RuntimeException(sprintf('Unable to kill the process (%s).', implode(' ', $output)));
                  }
  
                  return false;
              }
          } else {
              if (!$this->isSigchildEnabled()) {
                  $ok = @proc_terminate($this->process, $signal);
              } elseif (\function_exists('posix_kill')) {
                  $ok = @posix_kill($pid, $signal);
              } elseif ($ok = proc_open(sprintf('kill -%d %d', $signal, $pid), [2 => ['pipe', 'w']], $pipes)) {
                  $ok = false === fgets($pipes[2]);
              }
              if (!$ok) {
                  if ($throwException) {
                      throw new RuntimeException(sprintf('Error while sending signal "%s".', $signal));
                  }
  
                  return false;
              }
          }
  
          $this->latestSignal = $signal;
          $this->fallbackStatus['signaled'] = true;
          $this->fallbackStatus['exitcode'] = -1;
          $this->fallbackStatus['termsig'] = $this->latestSignal;
  
          return true;
      }
code_tokens: private function doSignal ( int $ signal , bool $ throwException ) : bool { if ( null === $ pid = $ this -> getPid ( ) ) { if ( $ throwException ) { throw new LogicException ( 'Can not send signal on a non running process.' ) ; } return false ; } if ( '\\' === \ DIRECTORY_SEPARATOR ) { exec ( sprintf ( 'taskkill /F /T /PID %d 2>&1' , $ pid ) , $ output , $ exitCode ) ; if ( $ exitCode && $ this -> isRunning ( ) ) { if ( $ throwException ) { throw new RuntimeException ( sprintf ( 'Unable to kill the process (%s).' , implode ( ' ' , $ output ) ) ) ; } return false ; } } else { if ( ! $ this -> isSigchildEnabled ( ) ) { $ ok = @ proc_terminate ( $ this -> process , $ signal ) ; } elseif ( \ function_exists ( 'posix_kill' ) ) { $ ok = @ posix_kill ( $ pid , $ signal ) ; } elseif ( $ ok = proc_open ( sprintf ( 'kill -%d %d' , $ signal , $ pid ) , [ 2 => [ 'pipe' , 'w' ] ] , $ pipes ) ) { $ ok = false === fgets ( $ pipes [ 2 ] ) ; } if ( ! $ ok ) { if ( $ throwException ) { throw new RuntimeException ( sprintf ( 'Error while sending signal "%s".' , $ signal ) ) ; } return false ; } } $ this -> latestSignal = $ signal ; $ this -> fallbackStatus [ 'signaled' ] = true ; $ this -> fallbackStatus [ 'exitcode' ] = - 1 ; $ this -> fallbackStatus [ 'termsig' ] = $ this -> latestSignal ; return true ; }
docstring: Sends a POSIX signal to the process.
  
  @param int  $signal         A valid POSIX signal (see http://www.php.net/manual/en/pcntl.constants.php)
  @param bool $throwException Whether to throw exception in case signal failed
  
  @return bool True if the signal was sent successfully, false otherwise
  
  @throws LogicException   In case the process is not running
  @throws RuntimeException In case --enable-sigchild is activated and the process can't be killed
  @throws RuntimeException In case of failure
docstring_tokens: Sends a POSIX signal to the process .