/**
  * {@inheritDoc}
  */
 public function sendSignal($signal)
 {
     // Only send signal when not sigterm.
     if (Process::SIGTERM !== $signal) {
         parent::sendSignal($signal);
     }
 }
 public function testAggregateLogger()
 {
     $this->skipIfNotUnix();
     $command = './tests/commands/unix/long_sleep_binary';
     $mockLogger = new MockPsrLogger();
     $allLogger = new AllLogger($mockLogger);
     $process = new Process(new UnixEnvironment(), $command, getcwd(), -1, 1000, new AggregateLogger(array($allLogger, new NullProcessObserver())));
     $process->sendSignal(Process::SIGTERM);
     $process->wait();
     $this->assertLogsMatch(array(array('level' => LogLevel::DEBUG, 'message' => 'Process created', 'context' => array('command' => './tests/commands/unix/long_sleep_binary')), array('level' => LogLevel::DEBUG, 'message' => 'Signal sent', 'context' => array('signal' => 'SIGTERM')), array('level' => LogLevel::DEBUG, 'message' => 'Process exited', 'context' => array('exit_code' => -1))), $mockLogger->getLogs());
 }
示例#3
0
 public function testSendInvalidSignal()
 {
     $this->skipIfNotUnix();
     $this->setExpectedException('\\ptlis\\ShellCommand\\Exceptions\\CommandExecutionException', 'Unknown signal "wibble" provided');
     $command = './tests/commands/unix/long_sleep_binary';
     $process = new Process(new UnixEnvironment(), $command, getcwd(), 500000, 1000, new NullProcessObserver());
     $process->sendSignal('wibble');
 }