isTerminatedAfterRun() публичный Метод

Returns whether the PHP process is terminated after running a command.
См. также: setTerminateAfterRun()
public isTerminatedAfterRun ( ) : boolean
Результат boolean Returns `true` if the PHP process is terminated after {@link run()} and `false` otherwise.
Пример #1
0
 /**
  * {@inheritdoc}
  */
 public function run(RawArgs $args = null, InputStream $inputStream = null, OutputStream $outputStream = null, OutputStream $errorStream = null)
 {
     // Render errors to the preliminary IO until the final IO is created
     $io = $this->preliminaryIo;
     try {
         if (null === $args) {
             $args = new ArgvArgs();
         }
         $ioFactory = $this->config->getIOFactory();
         if (null === $ioFactory) {
             throw new LogicException('The IO factory must be set.');
         }
         /** @var IO $io */
         $io = call_user_func($ioFactory, $this, $args, $inputStream, $outputStream, $errorStream);
         $resolvedCommand = $this->resolveCommand($args);
         $command = $resolvedCommand->getCommand();
         $parsedArgs = $resolvedCommand->getArgs();
         $statusCode = $command->handle($parsedArgs, $io);
     } catch (Exception $e) {
         if (!$this->config->isExceptionCaught()) {
             throw $e;
         }
         $trace = new ExceptionTrace($e);
         $trace->render($io);
         $statusCode = $this->exceptionToExitCode($e->getCode());
     }
     if ($this->config->isTerminatedAfterRun()) {
         exit($statusCode);
     }
     return $statusCode;
 }
Пример #2
0
 public function testSetTerminateAfterRun()
 {
     $this->config->setTerminateAfterRun(true);
     $this->assertTrue($this->config->isTerminatedAfterRun());
     $this->config->setTerminateAfterRun(false);
     $this->assertFalse($this->config->isTerminatedAfterRun());
 }