You are here

public function SimpleProcessTest::testTermSignalTerminatesProcessCleanly in Zircon Profile 8.0

Same name and namespace in other branches
  1. 8 vendor/symfony/process/Tests/SimpleProcessTest.php \Symfony\Component\Process\Tests\SimpleProcessTest::testTermSignalTerminatesProcessCleanly()

File

vendor/symfony/process/Tests/SimpleProcessTest.php, line 178

Class

SimpleProcessTest

Namespace

Symfony\Component\Process\Tests

Code

public function testTermSignalTerminatesProcessCleanly() {
  $this
    ->expectExceptionIfPHPSigchild('Symfony\\Component\\Process\\Exception\\RuntimeException', 'This PHP has been compiled with --enable-sigchild. The process can not be signaled.');
  try {
    $process = $this
      ->getProcess(self::$phpBin . ' -r "echo \'foo\'; sleep(1); echo \'bar\';"');
    $process
      ->run(function () use ($process) {
      if ($process
        ->isRunning()) {
        $process
          ->signal(defined('SIGTERM') ? SIGTERM : 15);
      }
    });
  } catch (\RuntimeException $e) {
    $this
      ->fail('A call to signal() is not expected to cause wait() to throw a RuntimeException');
  }
}