Skip to main content
Drupal API
User account menu
  • Log in

Breadcrumb

  1. Drupal Core 11.1.x
  2. Process.php

function Process::updateStatus

Updates the status of the process, reads pipes.

Parameters

bool $blocking Whether to use a blocking read call:

8 calls to Process::updateStatus()
Process::getExitCode in vendor/symfony/process/Process.php
Returns the exit code returned by the process.
Process::getStatus in vendor/symfony/process/Process.php
Gets the process status.
Process::isRunning in vendor/symfony/process/Process.php
Checks if the process is currently running.
Process::isTerminated in vendor/symfony/process/Process.php
Checks if the process is terminated.
Process::readPipesForOutput in vendor/symfony/process/Process.php
Reads pipes for the freshest output.

... See full list

File

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

Class

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

Namespace

Symfony\Component\Process

Code

protected function updateStatus(bool $blocking) : void {
    if (self::STATUS_STARTED !== $this->status) {
        return;
    }
    $this->processInformation = proc_get_status($this->process);
    $running = $this->processInformation['running'];
    // In PHP < 8.3, "proc_get_status" only returns the correct exit status on the first call.
    // Subsequent calls return -1 as the process is discarded. This workaround caches the first
    // retrieved exit status for consistent results in later calls, mimicking PHP 8.3 behavior.
    if (\PHP_VERSION_ID < 80300) {
        if (!isset($this->cachedExitCode) && !$running && -1 !== $this->processInformation['exitcode']) {
            $this->cachedExitCode = $this->processInformation['exitcode'];
        }
        if (isset($this->cachedExitCode) && !$running && -1 === $this->processInformation['exitcode']) {
            $this->processInformation['exitcode'] = $this->cachedExitCode;
        }
    }
    $this->readPipes($running && $blocking, '\\' !== \DIRECTORY_SEPARATOR || !$running);
    if ($this->fallbackStatus && $this->isSigchildEnabled()) {
        $this->processInformation = $this->fallbackStatus + $this->processInformation;
    }
    if (!$running) {
        $this->close();
    }
}
RSS feed
Powered by Drupal