GracefulDeath\LastWill::stop PHP Method

stop() public method

public stop ( )
    public function stop()
    {
        $this->capturedFromStdout = $this->contentOf($this->stdoutFilePath);
        $this->capturedFromStderr = $this->removeErrorLogHeaderFromEachLine($this->contentOf($this->stderrFilePath));
    }

Usage Example

コード例 #1
0
 public function run()
 {
     $attempts = 0;
     while (true) {
         $attempts += 1;
         $lastWill = new LastWill($this->options);
         $pid = pcntl_fork();
         if ($pid >= 0) {
             if ($pid) {
                 $this->catchAndForwardSignalTo($pid);
                 $status = $this->waitUntilProcessDiesAndReturnStatus($pid);
                 $lastWill->stop();
                 list($tryAnotherTime, $result) = $this->afterChildDeathWithStatus($this->exitStatusOfLastChild($status), $attempts, $lastWill);
                 if (!$tryAnotherTime) {
                     return $result;
                 }
             } else {
                 $life = new Life($attempts);
                 $this->catchSignalsFor($life);
                 $lastWill->capture();
                 return call_user_func($this->main, $life);
             }
         }
     }
 }