You are here

public function Process::__construct in Zircon Profile 8

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

Constructor.

Parameters

string $commandline The command line to run:

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:

string|null $input The input:

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

array $options An array of options for proc_open:

Throws

RuntimeException When proc_open is not installed

1 call to Process::__construct()
PhpProcess::__construct in vendor/symfony/process/PhpProcess.php
Constructor.
1 method overrides Process::__construct()
PhpProcess::__construct in vendor/symfony/process/PhpProcess.php
Constructor.

File

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

Class

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

Namespace

Symfony\Component\Process

Code

public function __construct($commandline, $cwd = null, array $env = null, $input = null, $timeout = 60, array $options = array()) {
  if (!function_exists('proc_open')) {
    throw new RuntimeException('The Process class relies on proc_open, which is not available on your PHP installation.');
  }
  $this->commandline = $commandline;
  $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/bug.php?id=51800
  // @see : https://bugs.php.net/bug.php?id=50524
  if (null === $this->cwd && (defined('ZEND_THREAD_SAFE') || '\\' === DIRECTORY_SEPARATOR)) {
    $this->cwd = getcwd();
  }
  if (null !== $env) {
    $this
      ->setEnv($env);
  }
  $this->input = $input;
  $this
    ->setTimeout($timeout);
  $this->useFileHandles = '\\' === DIRECTORY_SEPARATOR;
  $this->pty = false;
  $this->enhanceWindowsCompatibility = true;
  $this->enhanceSigchildCompatibility = '\\' !== DIRECTORY_SEPARATOR && $this
    ->isSigchildEnabled();
  $this->options = array_replace(array(
    'suppress_errors' => true,
    'binary_pipes' => true,
  ), $options);
}