Пример #1
0
 /**
  * {@inheritdoc}
  */
 public function run(JobReportInterface $report)
 {
     try {
         $this->process->start();
         $this->savePid($this->process->getPid(), $report);
         while ($this->process->isRunning()) {
             // waiting for process to finish
         }
         if ($this->process->isSuccessful()) {
             $report->setOutput(trim($this->process->getOutput()));
             return JobState::STATE_FINISHED;
         }
         $report->setErrorOutput(trim($this->process->getErrorOutput()));
     } catch (LogicException $e) {
         $report->setErrorOutput($e->getMessage());
     } catch (RuntimeException $e) {
         $report->setErrorOutput($e->getMessage());
     }
     return JobState::STATE_FAILED;
 }