public function Process::__construct

Constructor.

@api

Parameters

string $commandline The command line to run:

string $cwd The working directory:

array $env The environment variables or null to inherit:

string $stdin The STDIN content:

integer $timeout The timeout in seconds:

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 drupal/core/vendor/symfony/process/Symfony/Component/Process/PhpProcess.php
Constructor.
1 method overrides Process::__construct()
PhpProcess::__construct in drupal/core/vendor/symfony/process/Symfony/Component/Process/PhpProcess.php
Constructor.

File

drupal/core/vendor/symfony/process/Symfony/Component/Process/Process.php, line 118

Class

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

Namespace

Symfony\Component\Process

Code

public function __construct($commandline, $cwd = null, array $env = null, $stdin = 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 = null === $cwd ? getcwd() : $cwd;
  if (null !== $env) {
    $this->env = array();
    foreach ($env as $key => $value) {
      $this->env[(string) $key] = (string) $value;
    }
  }
  else {
    $this->env = null;
  }
  $this->stdin = $stdin;
  $this
    ->setTimeout($timeout);
  $this->enhanceWindowsCompatibility = true;
  $this->options = array_replace(array(
    'suppress_errors' => true,
    'binary_pipes' => true,
  ), $options);
}