You are here

public function Process::checkTimeout in Zircon Profile 8.0

Same name and namespace in other branches
  1. 8 vendor/symfony/process/Process.php \Symfony\Component\Process\Process::checkTimeout()

Performs a check between the timeout definition and the time the process started.

In case you run a background process (with the start method), you should trigger this method regularly to ensure the process timeout

Throws

ProcessTimedOutException In case the timeout was reached

2 calls to Process::checkTimeout()
Process::start in vendor/symfony/process/Process.php
Starts the process and returns after writing the input to STDIN.
Process::wait in vendor/symfony/process/Process.php
Waits for the process to terminate.

File

vendor/symfony/process/Process.php, line 1195

Class

Process
Process is a thin wrapper around proc_* functions to easily start independent PHP processes.

Namespace

Symfony\Component\Process

Code

public function checkTimeout() {
  if ($this->status !== self::STATUS_STARTED) {
    return;
  }
  if (null !== $this->timeout && $this->timeout < microtime(true) - $this->starttime) {
    $this
      ->stop(0);
    throw new ProcessTimedOutException($this, ProcessTimedOutException::TYPE_GENERAL);
  }
  if (null !== $this->idleTimeout && $this->idleTimeout < microtime(true) - $this->lastOutputTime) {
    $this
      ->stop(0);
    throw new ProcessTimedOutException($this, ProcessTimedOutException::TYPE_IDLE);
  }
}