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

Breadcrumb

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

function Process::__construct

Same name in this branch
  1. 11.1.x vendor/php-tuf/composer-stager/src/Internal/Process/Service/Process.php \PhpTuf\ComposerStager\Internal\Process\Service\Process::__construct()

Parameters

array $command The command to run and its arguments listed as separate entries:

string|null $cwd The working directory or null to use the working dir of the current PHP process:

array|null $env The environment variables or null to use the same environment as the current PHP process:

mixed $input The input as stream resource, scalar or \Traversable, or null for no input:

int|float|null $timeout The timeout in seconds or null to disable:

Throws

LogicException When proc_open is not installed

4 calls to Process::__construct()
PhpProcess::__construct in vendor/symfony/process/PhpProcess.php
PhpProcess::__construct in vendor/symfony/process/PhpProcess.php
PhpSubprocess::__construct in vendor/symfony/process/PhpSubprocess.php
PhpSubprocess::__construct in vendor/symfony/process/PhpSubprocess.php
2 methods override Process::__construct()
PhpProcess::__construct in vendor/symfony/process/PhpProcess.php
PhpSubprocess::__construct in vendor/symfony/process/PhpSubprocess.php

File

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

Class

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

Namespace

Symfony\Component\Process

Code

public function __construct(array $command, ?string $cwd = null, ?array $env = null, mixed $input = null, ?float $timeout = 60) {
    if (!\function_exists('proc_open')) {
        throw new LogicException('The Process class relies on proc_open, which is not available on your PHP installation.');
    }
    $this->commandline = $command;
    $this->cwd = $cwd;
    // on Windows, if the cwd changed via chdir(), proc_open defaults to the dir where PHP was started
    // on Gnu/Linux, PHP builds with --enable-maintainer-zts are also affected
    // @see : https://bugs.php.net/51800
    // @see : https://bugs.php.net/50524
    if (null === $this->cwd && (\defined('ZEND_THREAD_SAFE') || '\\' === \DIRECTORY_SEPARATOR)) {
        $this->cwd = getcwd();
    }
    if (null !== $env) {
        $this->setEnv($env);
    }
    $this->setInput($input);
    $this->setTimeout($timeout);
    $this->pty = false;
}
RSS feed
Powered by Drupal