當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。