当前位置: 首页>>代码示例>>PHP>>正文


PHP Process::isTerminated方法代码示例

本文整理汇总了PHP中Symfony\Component\Process\Process::isTerminated方法的典型用法代码示例。如果您正苦于以下问题:PHP Process::isTerminated方法的具体用法?PHP Process::isTerminated怎么用?PHP Process::isTerminated使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Symfony\Component\Process\Process的用法示例。


在下文中一共展示了Process::isTerminated方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: wait

 /**
  * {@inheritdoc}
  */
 public function wait(Process $process)
 {
     $start = microtime(true);
     $end = $start + $this->timeout / 1000;
     while (!$process->isTerminated() && microtime(true) < $end) {
         usleep(self::TICK * 1000);
     }
     if ($process->isRunning()) {
         $callback = $this->callback;
         $callback();
     }
     $process->wait();
 }
开发者ID:Elfiggo,项目名称:dock-cli,代码行数:16,代码来源:TimeoutWait.php

示例2: handleProcess

 /**
  * @return bool
  */
 private function handleProcess(Process $process)
 {
     if ($process->isStarted()) {
         if ($process->isTerminated()) {
             $this->running--;
             return true;
         }
         return false;
     }
     // Only start a new process if we haven't reached the limit yet.
     if ($this->running < $this->config->getProcessAsyncLimit()) {
         $process->start();
         $this->running++;
     }
     return false;
 }
开发者ID:phpro,项目名称:grumphp,代码行数:19,代码来源:AsyncProcessRunner.php

示例3: testLockingFunctionality

 public function testLockingFunctionality()
 {
     if (!class_exists('AppKernel')) {
         $this->markTestSkipped("This test does only work if a full application is installed (including AppKernel class");
     }
     $commandName = $this->getCommand()->getName();
     $reflector = new \ReflectionClass(\AppKernel::class);
     $appDirectory = dirname($reflector->getFileName());
     // start commands in a separate processes
     $process1 = new Process("php {$appDirectory}/console {$commandName} --env=test");
     $process2 = new Process("php {$appDirectory}/console {$commandName} --env=test");
     $process1->start();
     $process2->start();
     // wait until both processes have terminated
     while (!$process1->isTerminated() || !$process2->isTerminated()) {
         usleep(10);
     }
     $this->assertContains('The command is already running in another process.', $process2->getOutput() . $process1->getOutput());
 }
开发者ID:azine,项目名称:email-bundle,代码行数:19,代码来源:SendNewsLetterCommandTest.php

示例4: basicProcess

 /**
  * @param string $command
  * @param OutputInterface $output
  * @param callable|null $callback A valid PHP callback
  */
 protected function basicProcess($command, OutputInterface $output, $callback = null)
 {
     $process = new Process($command);
     $process->setTimeout(600);
     $output->writeln($this->helper->formatSection('Executing', $process->getCommandLine(), 'comment'));
     $process->start();
     $process->wait(function ($type, $buffer) use($output) {
         if (Process::ERR == $type) {
             $output->write($this->helper->formatSection('Error', $buffer, 'error'));
         } else {
             $output->write($this->helper->formatSection('Progress', $buffer, 'comment'));
         }
     });
     if ($process->isTerminated()) {
         $output->writeln($this->helper->formatSection('Finishing', $process->getCommandLine(), 'comment'));
         if (null !== $callback) {
             $callback();
         }
     }
 }
开发者ID:performerSpa,项目名称:PerformerVagrantBundle,代码行数:25,代码来源:BasicCommand.php

示例5: isDoneRunning

 /**
  * Check if the process has terminated.
  *
  * @return bool
  */
 public function isDoneRunning()
 {
     return $this->process->isTerminated();
 }
开发者ID:jrijnaars,项目名称:PHP-project,代码行数:9,代码来源:ExecutableTest.php

示例6: startServer

 /**
  * @param $address
  * @param $environment
  */
 protected function startServer()
 {
     $publicDir = $this->getApplication()->getWorkingPath() . DS . 'public';
     $shellCommand = $this->getBaseCommand();
     $process = new Process($shellCommand, $publicDir);
     if ($this->getInput()->getOption('background')) {
         $process->disableOutput();
         $process->start();
         $processId = $this->getProcessId();
         $this->getApplication()->getConfig()->setOption('server', ['pid' => $processId, 'address' => $address = 'http://' . $this->getAddress()]);
         $this->getOutput()->writeln($this->info('Server has been started at ' . $address));
     } else {
         while ($process instanceof Process) {
             if (!$process->isStarted()) {
                 $process->start();
                 continue;
             }
             echo $process->getIncrementalOutput();
             echo $process->getIncrementalErrorOutput();
             if (!$process->isRunning() || $process->isTerminated()) {
                 $process = false;
                 $this->getOutput()->writeln("");
                 $this->getOutput()->writeln($this->info('Server has been stopped.'));
             }
             sleep(1);
         }
     }
 }
开发者ID:bluzphp,项目名称:bluzman,代码行数:32,代码来源:StartCommand.php


注:本文中的Symfony\Component\Process\Process::isTerminated方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。