ILIAS  release_5-2 Revision v5.2.25-18-g3f80b828510
Symfony\Component\Process\Process Class Reference

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

+ Inheritance diagram for Symfony\Component\Process\Process:
+ Collaboration diagram for Symfony\Component\Process\Process:

Public Member Functions

 __construct ($commandline, $cwd=null, array $env=null, $input=null, $timeout=60, array $options=array())
 Constructor. More...
 
 __destruct ()
 
 __clone ()
 
 run ($callback=null)
 Runs the process. More...
 
 mustRun (callable $callback=null)
 Runs the process. More...
 
 start (callable $callback=null)
 Starts the process and returns after writing the input to STDIN. More...
 
 restart (callable $callback=null)
 Restarts the process. More...
 
 wait (callable $callback=null)
 Waits for the process to terminate. More...
 
 getPid ()
 Returns the Pid (process identifier), if applicable. More...
 
 signal ($signal)
 Sends a POSIX signal to the process. More...
 
 disableOutput ()
 Disables fetching output and error output from the underlying process. More...
 
 enableOutput ()
 Enables fetching output and error output from the underlying process. More...
 
 isOutputDisabled ()
 Returns true in case the output is disabled, false otherwise. More...
 
 getOutput ()
 Returns the current output of the process (STDOUT). More...
 
 getIncrementalOutput ()
 Returns the output incrementally. More...
 
 getIterator ($flags=0)
 Returns an iterator to the output of the process, with the output type as keys (Process::OUT/ERR). More...
 
 clearOutput ()
 Clears the process output. More...
 
 getErrorOutput ()
 Returns the current error output of the process (STDERR). More...
 
 getIncrementalErrorOutput ()
 Returns the errorOutput incrementally. More...
 
 clearErrorOutput ()
 Clears the process output. More...
 
 getExitCode ()
 Returns the exit code returned by the process. More...
 
 getExitCodeText ()
 Returns a string representation for the exit code returned by the process. More...
 
 isSuccessful ()
 Checks if the process ended successfully. More...
 
 hasBeenSignaled ()
 Returns true if the child process has been terminated by an uncaught signal. More...
 
 getTermSignal ()
 Returns the number of the signal that caused the child process to terminate its execution. More...
 
 hasBeenStopped ()
 Returns true if the child process has been stopped by a signal. More...
 
 getStopSignal ()
 Returns the number of the signal that caused the child process to stop its execution. More...
 
 isRunning ()
 Checks if the process is currently running. More...
 
 isStarted ()
 Checks if the process has been started with no regard to the current state. More...
 
 isTerminated ()
 Checks if the process is terminated. More...
 
 getStatus ()
 Gets the process status. More...
 
 stop ($timeout=10, $signal=null)
 Stops the process. More...
 
 addOutput ($line)
 Adds a line to the STDOUT stream. More...
 
 addErrorOutput ($line)
 Adds a line to the STDERR stream. More...
 
 getCommandLine ()
 Gets the command line to be executed. More...
 
 setCommandLine ($commandline)
 Sets the command line to be executed. More...
 
 getTimeout ()
 Gets the process timeout (max. More...
 
 getIdleTimeout ()
 Gets the process idle timeout (max. More...
 
 setTimeout ($timeout)
 Sets the process timeout (max. More...
 
 setIdleTimeout ($timeout)
 Sets the process idle timeout (max. More...
 
 setTty ($tty)
 Enables or disables the TTY mode. More...
 
 isTty ()
 Checks if the TTY mode is enabled. More...
 
 setPty ($bool)
 Sets PTY mode. More...
 
 isPty ()
 Returns PTY state. More...
 
 getWorkingDirectory ()
 Gets the working directory. More...
 
 setWorkingDirectory ($cwd)
 Sets the current working directory. More...
 
 getEnv ()
 Gets the environment variables. More...
 
 setEnv (array $env)
 Sets the environment variables. More...
 
 getInput ()
 Gets the Process input. More...
 
 setInput ($input)
 Sets the input. More...
 
 getOptions ()
 Gets the options for proc_open. More...
 
 setOptions (array $options)
 Sets the options for proc_open. More...
 
 getEnhanceWindowsCompatibility ()
 Gets whether or not Windows compatibility is enabled. More...
 
 setEnhanceWindowsCompatibility ($enhance)
 Sets whether or not Windows compatibility is enabled. More...
 
 getEnhanceSigchildCompatibility ()
 Returns whether sigchild compatibility mode is activated or not. More...
 
 setEnhanceSigchildCompatibility ($enhance)
 Activates sigchild compatibility mode. More...
 
 checkTimeout ()
 Performs a check between the timeout definition and the time the process started. More...
 

Static Public Member Functions

static isPtySupported ()
 Returns whether PTY is supported on the current operating system. More...
 

Data Fields

const ERR = 'err'
 
const OUT = 'out'
 
const STATUS_READY = 'ready'
 
const STATUS_STARTED = 'started'
 
const STATUS_TERMINATED = 'terminated'
 
const STDIN = 0
 
const STDOUT = 1
 
const STDERR = 2
 
const TIMEOUT_PRECISION = 0.2
 
const ITER_NON_BLOCKING = 1
 
const ITER_KEEP_OUTPUT = 2
 
const ITER_SKIP_OUT = 4
 
const ITER_SKIP_ERR = 8
 

Static Public Attributes

static $exitCodes
 

Protected Member Functions

 buildCallback (callable $callback=null)
 Builds up the callback used by wait(). More...
 
 updateStatus ($blocking)
 Updates the status of the process, reads pipes. More...
 
 isSigchildEnabled ()
 Returns whether PHP has been compiled with the '–enable-sigchild' option or not. More...
 

Private Member Functions

 getDescriptors ()
 Creates the descriptors needed by the proc_open. More...
 
 readPipesForOutput ($caller, $blocking=false)
 Reads pipes for the freshest output. More...
 
 validateTimeout ($timeout)
 Validates and returns the filtered timeout. More...
 
 readPipes ($blocking, $close)
 Reads pipes, executes callback. More...
 
 close ()
 Closes process resource, closes file handles, sets the exitcode. More...
 
 resetProcessData ()
 Resets data related to the latest run of the process. More...
 
 doSignal ($signal, $throwException)
 Sends a POSIX signal to the process. More...
 
 requireProcessIsStarted ($functionName)
 Ensures the process is running or terminated, throws a LogicException if the process has a not started. More...
 
 requireProcessIsTerminated ($functionName)
 Ensures the process is terminated, throws a LogicException if the process has a status different than terminated. More...
 

Private Attributes

 $callback
 
 $hasCallback = false
 
 $commandline
 
 $cwd
 
 $env
 
 $input
 
 $starttime
 
 $lastOutputTime
 
 $timeout
 
 $idleTimeout
 
 $options
 
 $exitcode
 
 $fallbackStatus = array()
 
 $processInformation
 
 $outputDisabled = false
 
 $stdout
 
 $stderr
 
 $enhanceWindowsCompatibility = true
 
 $enhanceSigchildCompatibility
 
 $process
 
 $status = self::STATUS_READY
 
 $incrementalOutputOffset = 0
 
 $incrementalErrorOutputOffset = 0
 
 $tty
 
 $pty
 
 $useFileHandles = false
 
 $processPipes
 
 $latestSignal
 

Static Private Attributes

static $sigchild
 

Detailed Description

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

Author
Fabien Potencier fabie.nosp@m.n@sy.nosp@m.mfony.nosp@m..com
Romain Neutron impre.nosp@m.c@gm.nosp@m.ail.c.nosp@m.om

Definition at line 30 of file Process.php.

Constructor & Destructor Documentation

◆ __construct()

Symfony\Component\Process\Process::__construct (   $commandline,
  $cwd = null,
array  $env = null,
  $input = null,
  $timeout = 60,
array  $options = array() 
)

Constructor.

Parameters
string$commandlineThe command line to run
string | null$cwdThe working directory or null to use the working dir of the current PHP process
array | null$envThe environment variables or null to use the same environment as the current PHP process
mixed | null$inputThe input as stream resource, scalar or , or null for no input
int | float | null$timeoutThe timeout in seconds or null to disable
array$optionsAn array of options for proc_open
Exceptions
RuntimeExceptionWhen proc_open is not installed

Definition at line 147 of file Process.php.

References Symfony\Component\Process\Process\$commandline, Symfony\Component\Process\Process\$cwd, Symfony\Component\Process\Process\$env, Symfony\Component\Process\Process\$input, Symfony\Component\Process\Process\$options, Symfony\Component\Process\Process\$timeout, array, defined, Symfony\Component\Process\Process\isSigchildEnabled(), Symfony\Component\Process\Process\setEnv(), Symfony\Component\Process\Process\setInput(), and Symfony\Component\Process\Process\setTimeout().

148  {
149  if (!function_exists('proc_open')) {
150  throw new RuntimeException('The Process class relies on proc_open, which is not available on your PHP installation.');
151  }
152 
153  $this->commandline = $commandline;
154  $this->cwd = $cwd;
155 
156  // on Windows, if the cwd changed via chdir(), proc_open defaults to the dir where PHP was started
157  // on Gnu/Linux, PHP builds with --enable-maintainer-zts are also affected
158  // @see : https://bugs.php.net/bug.php?id=51800
159  // @see : https://bugs.php.net/bug.php?id=50524
160  if (null === $this->cwd && (defined('ZEND_THREAD_SAFE') || '\\' === DIRECTORY_SEPARATOR)) {
161  $this->cwd = getcwd();
162  }
163  if (null !== $env) {
164  $this->setEnv($env);
165  }
166 
167  $this->setInput($input);
168  $this->setTimeout($timeout);
169  $this->useFileHandles = '\\' === DIRECTORY_SEPARATOR;
170  $this->pty = false;
171  $this->enhanceWindowsCompatibility = true;
172  $this->enhanceSigchildCompatibility = '\\' !== DIRECTORY_SEPARATOR && $this->isSigchildEnabled();
173  $this->options = array_replace(array('suppress_errors' => true, 'binary_pipes' => true), $options);
174  }
setEnv(array $env)
Sets the environment variables.
Definition: Process.php:1075
setTimeout($timeout)
Sets the process timeout (max.
Definition: Process.php:935
Create styles array
The data for the language used.
isSigchildEnabled()
Returns whether PHP has been compiled with the '–enable-sigchild' option or not. ...
Definition: Process.php:1331
setInput($input)
Sets the input.
Definition: Process.php:1111
defined( 'APPLICATION_ENV')||define( 'APPLICATION_ENV'
Definition: bootstrap.php:27
+ Here is the call graph for this function:

◆ __destruct()

Symfony\Component\Process\Process::__destruct ( )

Definition at line 176 of file Process.php.

References Symfony\Component\Process\Process\stop().

177  {
178  $this->stop(0);
179  }
stop($timeout=10, $signal=null)
Stops the process.
Definition: Process.php:819
+ Here is the call graph for this function:

Member Function Documentation

◆ __clone()

Symfony\Component\Process\Process::__clone ( )

Definition at line 181 of file Process.php.

References Symfony\Component\Process\Process\resetProcessData().

182  {
183  $this->resetProcessData();
184  }
resetProcessData()
Resets data related to the latest run of the process.
Definition: Process.php:1443
+ Here is the call graph for this function:

◆ addErrorOutput()

Symfony\Component\Process\Process::addErrorOutput (   $line)

Adds a line to the STDERR stream.

Definition at line 871 of file Process.php.

Referenced by Symfony\Component\Process\Process\buildCallback().

872  {
873  $this->lastOutputTime = microtime(true);
874 
875  fseek($this->stderr, 0, SEEK_END);
876  fwrite($this->stderr, $line);
877  fseek($this->stderr, $this->incrementalErrorOutputOffset);
878  }
+ Here is the caller graph for this function:

◆ addOutput()

Symfony\Component\Process\Process::addOutput (   $line)

Adds a line to the STDOUT stream.

Definition at line 855 of file Process.php.

Referenced by Symfony\Component\Process\Process\buildCallback().

856  {
857  $this->lastOutputTime = microtime(true);
858 
859  fseek($this->stdout, 0, SEEK_END);
860  fwrite($this->stdout, $line);
861  fseek($this->stdout, $this->incrementalOutputOffset);
862  }
+ Here is the caller graph for this function:

◆ buildCallback()

Symfony\Component\Process\Process::buildCallback ( callable  $callback = null)
protected

Builds up the callback used by wait().

The callbacks adds all occurred output to the specific buffer and calls the user callback (if present) with the received output.

Parameters
callable | null$callbackThe user defined PHP callback
Returns
A PHP closure

Definition at line 1276 of file Process.php.

References Symfony\Component\Process\Process\$callback, $data, $out, Symfony\Component\Process\Process\addErrorOutput(), and Symfony\Component\Process\Process\addOutput().

Referenced by Symfony\Component\Process\Process\start(), and Symfony\Component\Process\Process\wait().

1277  {
1278  if ($this->outputDisabled) {
1279  return function ($type, $data) use ($callback) {
1280  if (null !== $callback) {
1281  call_user_func($callback, $type, $data);
1282  }
1283  };
1284  }
1285 
1286  $out = self::OUT;
1287 
1288  return function ($type, $data) use ($callback, $out) {
1289  if ($out == $type) {
1290  $this->addOutput($data);
1291  } else {
1292  $this->addErrorOutput($data);
1293  }
1294 
1295  if (null !== $callback) {
1296  call_user_func($callback, $type, $data);
1297  }
1298  };
1299  }
addOutput($line)
Adds a line to the STDOUT stream.
Definition: Process.php:855
addErrorOutput($line)
Adds a line to the STDERR stream.
Definition: Process.php:871
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ checkTimeout()

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

Exceptions
ProcessTimedOutExceptionIn case the timeout was reached

Definition at line 1208 of file Process.php.

References Symfony\Component\Process\Process\stop(), Symfony\Component\Process\Exception\ProcessTimedOutException\TYPE_GENERAL, and Symfony\Component\Process\Exception\ProcessTimedOutException\TYPE_IDLE.

Referenced by Symfony\Component\Process\Process\start(), and Symfony\Component\Process\Process\wait().

1209  {
1210  if ($this->status !== self::STATUS_STARTED) {
1211  return;
1212  }
1213 
1214  if (null !== $this->timeout && $this->timeout < microtime(true) - $this->starttime) {
1215  $this->stop(0);
1216 
1217  throw new ProcessTimedOutException($this, ProcessTimedOutException::TYPE_GENERAL);
1218  }
1219 
1220  if (null !== $this->idleTimeout && $this->idleTimeout < microtime(true) - $this->lastOutputTime) {
1221  $this->stop(0);
1222 
1223  throw new ProcessTimedOutException($this, ProcessTimedOutException::TYPE_IDLE);
1224  }
1225  }
stop($timeout=10, $signal=null)
Stops the process.
Definition: Process.php:819
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ clearErrorOutput()

Symfony\Component\Process\Process::clearErrorOutput ( )

Clears the process output.

Returns
Process

Definition at line 628 of file Process.php.

Referenced by Symfony\Component\Process\Process\getIterator().

629  {
630  ftruncate($this->stderr, 0);
631  fseek($this->stderr, 0);
632  $this->incrementalErrorOutputOffset = 0;
633 
634  return $this;
635  }
+ Here is the caller graph for this function:

◆ clearOutput()

Symfony\Component\Process\Process::clearOutput ( )

Clears the process output.

Returns
Process

Definition at line 569 of file Process.php.

Referenced by Symfony\Component\Process\Process\getIterator().

570  {
571  ftruncate($this->stdout, 0);
572  fseek($this->stdout, 0);
573  $this->incrementalOutputOffset = 0;
574 
575  return $this;
576  }
+ Here is the caller graph for this function:

◆ close()

Symfony\Component\Process\Process::close ( )
private

Closes process resource, closes file handles, sets the exitcode.

Returns
int The exitcode

Definition at line 1413 of file Process.php.

References Symfony\Component\Process\Process\$exitcode, and Symfony\Component\Process\Process\isSigchildEnabled().

Referenced by Symfony\Component\Process\Process\stop(), and Symfony\Component\Process\Process\updateStatus().

1414  {
1415  $this->processPipes->close();
1416  if (is_resource($this->process)) {
1417  proc_close($this->process);
1418  }
1419  $this->exitcode = $this->processInformation['exitcode'];
1420  $this->status = self::STATUS_TERMINATED;
1421 
1422  if (-1 === $this->exitcode) {
1423  if ($this->processInformation['signaled'] && 0 < $this->processInformation['termsig']) {
1424  // if process has been signaled, no exitcode but a valid termsig, apply Unix convention
1425  $this->exitcode = 128 + $this->processInformation['termsig'];
1426  } elseif ($this->enhanceSigchildCompatibility && $this->isSigchildEnabled()) {
1427  $this->processInformation['signaled'] = true;
1428  $this->processInformation['termsig'] = -1;
1429  }
1430  }
1431 
1432  // Free memory from self-reference callback created by buildCallback
1433  // Doing so in other contexts like __destruct or by garbage collector is ineffective
1434  // Now pipes are closed, so the callback is no longer necessary
1435  $this->callback = null;
1436 
1437  return $this->exitcode;
1438  }
isSigchildEnabled()
Returns whether PHP has been compiled with the &#39;–enable-sigchild&#39; option or not. ...
Definition: Process.php:1331
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ disableOutput()

Symfony\Component\Process\Process::disableOutput ( )

Disables fetching output and error output from the underlying process.

Returns
Process
Exceptions
RuntimeExceptionIn case the process is already running
LogicExceptionif an idle timeout is set

Definition at line 422 of file Process.php.

References Symfony\Component\Process\Process\isRunning().

423  {
424  if ($this->isRunning()) {
425  throw new RuntimeException('Disabling output while the process is running is not possible.');
426  }
427  if (null !== $this->idleTimeout) {
428  throw new LogicException('Output can not be disabled while an idle timeout is set.');
429  }
430 
431  $this->outputDisabled = true;
432 
433  return $this;
434  }
isRunning()
Checks if the process is currently running.
Definition: Process.php:764
+ Here is the call graph for this function:

◆ doSignal()

Symfony\Component\Process\Process::doSignal (   $signal,
  $throwException 
)
private

Sends a POSIX signal to the process.

Parameters
int$signalA valid POSIX signal (see http://www.php.net/manual/en/pcntl.constants.php)
bool$throwExceptionWhether to throw exception in case signal failed
Returns
bool True if the signal was sent successfully, false otherwise
Exceptions
LogicExceptionIn case the process is not running
RuntimeExceptionIn case –enable-sigchild is activated and the process can't be killed
RuntimeExceptionIn case of failure

Definition at line 1471 of file Process.php.

References Symfony\Component\Process\Process\$latestSignal, $ok, $output, array, Symfony\Component\Process\Process\getPid(), Symfony\Component\Process\Process\isRunning(), and Symfony\Component\Process\Process\isSigchildEnabled().

Referenced by Symfony\Component\Process\Process\signal(), and Symfony\Component\Process\Process\stop().

1472  {
1473  if (null === $pid = $this->getPid()) {
1474  if ($throwException) {
1475  throw new LogicException('Can not send signal on a non running process.');
1476  }
1477 
1478  return false;
1479  }
1480 
1481  if ('\\' === DIRECTORY_SEPARATOR) {
1482  exec(sprintf('taskkill /F /T /PID %d 2>&1', $pid), $output, $exitCode);
1483  if ($exitCode && $this->isRunning()) {
1484  if ($throwException) {
1485  throw new RuntimeException(sprintf('Unable to kill the process (%s).', implode(' ', $output)));
1486  }
1487 
1488  return false;
1489  }
1490  } else {
1491  if (!$this->enhanceSigchildCompatibility || !$this->isSigchildEnabled()) {
1492  $ok = @proc_terminate($this->process, $signal);
1493  } elseif (function_exists('posix_kill')) {
1494  $ok = @posix_kill($pid, $signal);
1495  } elseif ($ok = proc_open(sprintf('kill -%d %d', $signal, $pid), array(2 => array('pipe', 'w')), $pipes)) {
1496  $ok = false === fgets($pipes[2]);
1497  }
1498  if (!$ok) {
1499  if ($throwException) {
1500  throw new RuntimeException(sprintf('Error while sending signal `%s`.', $signal));
1501  }
1502 
1503  return false;
1504  }
1505  }
1506 
1507  $this->latestSignal = (int) $signal;
1508  $this->fallbackStatus['signaled'] = true;
1509  $this->fallbackStatus['exitcode'] = -1;
1510  $this->fallbackStatus['termsig'] = $this->latestSignal;
1511 
1512  return true;
1513  }
if(!is_dir( $entity_dir)) exit("Fatal Error ([A-Za-z0-9]+)\+" &#(? foreach( $entity_files as $file) $output
isRunning()
Checks if the process is currently running.
Definition: Process.php:764
Create styles array
The data for the language used.
getPid()
Returns the Pid (process identifier), if applicable.
Definition: Process.php:391
isSigchildEnabled()
Returns whether PHP has been compiled with the &#39;–enable-sigchild&#39; option or not. ...
Definition: Process.php:1331
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ enableOutput()

Symfony\Component\Process\Process::enableOutput ( )

Enables fetching output and error output from the underlying process.

Returns
Process
Exceptions
RuntimeExceptionIn case the process is already running

Definition at line 443 of file Process.php.

References Symfony\Component\Process\Process\isRunning().

444  {
445  if ($this->isRunning()) {
446  throw new RuntimeException('Enabling output while the process is running is not possible.');
447  }
448 
449  $this->outputDisabled = false;
450 
451  return $this;
452  }
isRunning()
Checks if the process is currently running.
Definition: Process.php:764
+ Here is the call graph for this function:

◆ getCommandLine()

Symfony\Component\Process\Process::getCommandLine ( )

◆ getDescriptors()

Symfony\Component\Process\Process::getDescriptors ( )
private

Creates the descriptors needed by the proc_open.

Returns
array

Definition at line 1252 of file Process.php.

References input, Symfony\Component\Process\Process\isPty(), and Symfony\Component\Process\Process\isTty().

Referenced by Symfony\Component\Process\Process\start().

1253  {
1254  if ($this->input instanceof \Iterator) {
1255  $this->input->rewind();
1256  }
1257  if ('\\' === DIRECTORY_SEPARATOR) {
1258  $this->processPipes = new WindowsPipes($this->input, !$this->outputDisabled || $this->hasCallback);
1259  } else {
1260  $this->processPipes = new UnixPipes($this->isTty(), $this->isPty(), $this->input, !$this->outputDisabled || $this->hasCallback);
1261  }
1262 
1263  return $this->processPipes->getDescriptors();
1264  }
input
Definition: langcheck.php:166
isTty()
Checks if the TTY mode is enabled.
Definition: Process.php:993
isPty()
Returns PTY state.
Definition: Process.php:1017
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getEnhanceSigchildCompatibility()

Symfony\Component\Process\Process::getEnhanceSigchildCompatibility ( )

Returns whether sigchild compatibility mode is activated or not.

Returns
bool

Definition at line 1177 of file Process.php.

References Symfony\Component\Process\Process\$enhanceSigchildCompatibility.

1178  {
1180  }

◆ getEnhanceWindowsCompatibility()

Symfony\Component\Process\Process::getEnhanceWindowsCompatibility ( )

Gets whether or not Windows compatibility is enabled.

This is true by default.

Returns
bool

Definition at line 1153 of file Process.php.

References Symfony\Component\Process\Process\$enhanceWindowsCompatibility.

1154  {
1156  }

◆ getEnv()

Symfony\Component\Process\Process::getEnv ( )

Gets the environment variables.

Returns
array The current environment variables

Definition at line 1057 of file Process.php.

References Symfony\Component\Process\Process\$env.

1058  {
1059  return $this->env;
1060  }

◆ getErrorOutput()

Symfony\Component\Process\Process::getErrorOutput ( )

Returns the current error output of the process (STDERR).

Returns
string The process error output
Exceptions
LogicExceptionin case the output has been disabled
LogicExceptionIn case the process is not started

Definition at line 586 of file Process.php.

References $ret, and Symfony\Component\Process\Process\readPipesForOutput().

Referenced by Symfony\Component\Process\Exception\ProcessFailedException\__construct(), and Assetic\Exception\FilterException\fromProcess().

587  {
588  $this->readPipesForOutput(__FUNCTION__);
589 
590  if (false === $ret = stream_get_contents($this->stderr, -1, 0)) {
591  return '';
592  }
593 
594  return $ret;
595  }
readPipesForOutput($caller, $blocking=false)
Reads pipes for the freshest output.
Definition: Process.php:1355
$ret
Definition: parser.php:6
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getExitCode()

Symfony\Component\Process\Process::getExitCode ( )

Returns the exit code returned by the process.

Returns
null|int The exit status code, null if the Process is not terminated
Exceptions
RuntimeExceptionIn case –enable-sigchild is activated and the sigchild compatibility mode is disabled

Definition at line 644 of file Process.php.

References Symfony\Component\Process\Process\$exitcode, Symfony\Component\Process\Process\isSigchildEnabled(), and Symfony\Component\Process\Process\updateStatus().

Referenced by Symfony\Component\Process\Exception\ProcessFailedException\__construct(), Symfony\Component\Process\Process\getExitCodeText(), and Symfony\Component\Process\Process\isSuccessful().

645  {
646  if (!$this->enhanceSigchildCompatibility && $this->isSigchildEnabled()) {
647  throw new RuntimeException('This PHP has been compiled with --enable-sigchild. You must use setEnhanceSigchildCompatibility() to use this method.');
648  }
649 
650  $this->updateStatus(false);
651 
652  return $this->exitcode;
653  }
updateStatus($blocking)
Updates the status of the process, reads pipes.
Definition: Process.php:1306
isSigchildEnabled()
Returns whether PHP has been compiled with the &#39;–enable-sigchild&#39; option or not. ...
Definition: Process.php:1331
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getExitCodeText()

Symfony\Component\Process\Process::getExitCodeText ( )

Returns a string representation for the exit code returned by the process.

This method relies on the Unix exit code status standardization and might not be relevant for other operating systems.

Returns
null|string A string representation for the exit status code, null if the Process is not terminated
See also
http://tldp.org/LDP/abs/html/exitcodes.html
http://en.wikipedia.org/wiki/Unix_signal

Definition at line 666 of file Process.php.

References Symfony\Component\Process\Process\$exitcode, and Symfony\Component\Process\Process\getExitCode().

Referenced by Symfony\Component\Process\Exception\ProcessFailedException\__construct().

667  {
668  if (null === $exitcode = $this->getExitCode()) {
669  return;
670  }
671 
672  return isset(self::$exitCodes[$exitcode]) ? self::$exitCodes[$exitcode] : 'Unknown error';
673  }
getExitCode()
Returns the exit code returned by the process.
Definition: Process.php:644
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getIdleTimeout()

Symfony\Component\Process\Process::getIdleTimeout ( )

Gets the process idle timeout (max.

time since last output).

Returns
float|null The timeout in seconds or null if it's disabled

Definition at line 919 of file Process.php.

References Symfony\Component\Process\Process\$idleTimeout.

920  {
921  return $this->idleTimeout;
922  }

◆ getIncrementalErrorOutput()

Symfony\Component\Process\Process::getIncrementalErrorOutput ( )

Returns the errorOutput incrementally.

In comparison with the getErrorOutput method which always return the whole error output, this one returns the new error output since the last call.

Returns
string The process error output since the last call
Exceptions
LogicExceptionin case the output has been disabled
LogicExceptionIn case the process is not started

Definition at line 609 of file Process.php.

References Symfony\Component\Process\Process\readPipesForOutput().

610  {
611  $this->readPipesForOutput(__FUNCTION__);
612 
613  $latest = stream_get_contents($this->stderr, -1, $this->incrementalErrorOutputOffset);
614  $this->incrementalErrorOutputOffset = ftell($this->stderr);
615 
616  if (false === $latest) {
617  return '';
618  }
619 
620  return $latest;
621  }
readPipesForOutput($caller, $blocking=false)
Reads pipes for the freshest output.
Definition: Process.php:1355
+ Here is the call graph for this function:

◆ getIncrementalOutput()

Symfony\Component\Process\Process::getIncrementalOutput ( )

Returns the output incrementally.

In comparison with the getOutput method which always return the whole output, this one returns the new output since the last call.

Returns
string The process output since the last call
Exceptions
LogicExceptionin case the output has been disabled
LogicExceptionIn case the process is not started

Definition at line 494 of file Process.php.

References Symfony\Component\Process\Process\readPipesForOutput().

495  {
496  $this->readPipesForOutput(__FUNCTION__);
497 
498  $latest = stream_get_contents($this->stdout, -1, $this->incrementalOutputOffset);
499  $this->incrementalOutputOffset = ftell($this->stdout);
500 
501  if (false === $latest) {
502  return '';
503  }
504 
505  return $latest;
506  }
readPipesForOutput($caller, $blocking=false)
Reads pipes for the freshest output.
Definition: Process.php:1355
+ Here is the call graph for this function:

◆ getInput()

Symfony\Component\Process\Process::getInput ( )

Gets the Process input.

Returns
resource|string||null The Process input

Definition at line 1095 of file Process.php.

References Symfony\Component\Process\Process\$input.

1096  {
1097  return $this->input;
1098  }

◆ getIterator()

Symfony\Component\Process\Process::getIterator (   $flags = 0)

Returns an iterator to the output of the process, with the output type as keys (Process::OUT/ERR).

Parameters
int$flagsA bit field of Process::ITER_* flags
Exceptions
LogicExceptionin case the output has been disabled
LogicExceptionIn case the process is not started
Returns

Definition at line 518 of file Process.php.

References $out, Symfony\Component\Process\Process\clearErrorOutput(), Symfony\Component\Process\Process\clearOutput(), and Symfony\Component\Process\Process\readPipesForOutput().

519  {
520  $this->readPipesForOutput(__FUNCTION__, false);
521 
522  $clearOutput = !(self::ITER_KEEP_OUTPUT & $flags);
523  $blocking = !(self::ITER_NON_BLOCKING & $flags);
524  $yieldOut = !(self::ITER_SKIP_OUT & $flags);
525  $yieldErr = !(self::ITER_SKIP_ERR & $flags);
526 
527  while (null !== $this->callback || ($yieldOut && !feof($this->stdout)) || ($yieldErr && !feof($this->stderr))) {
528  if ($yieldOut) {
529  $out = stream_get_contents($this->stdout, -1, $this->incrementalOutputOffset);
530 
531  if (isset($out[0])) {
532  if ($clearOutput) {
533  $this->clearOutput();
534  } else {
535  $this->incrementalOutputOffset = ftell($this->stdout);
536  }
537 
538  yield self::OUT => $out;
539  }
540  }
541 
542  if ($yieldErr) {
543  $err = stream_get_contents($this->stderr, -1, $this->incrementalErrorOutputOffset);
544 
545  if (isset($err[0])) {
546  if ($clearOutput) {
547  $this->clearErrorOutput();
548  } else {
549  $this->incrementalErrorOutputOffset = ftell($this->stderr);
550  }
551 
552  yield self::ERR => $err;
553  }
554  }
555 
556  if (!$blocking && !isset($out[0]) && !isset($err[0])) {
557  yield self::OUT => '';
558  }
559 
560  $this->readPipesForOutput(__FUNCTION__, $blocking);
561  }
562  }
clearErrorOutput()
Clears the process output.
Definition: Process.php:628
readPipesForOutput($caller, $blocking=false)
Reads pipes for the freshest output.
Definition: Process.php:1355
clearOutput()
Clears the process output.
Definition: Process.php:569
+ Here is the call graph for this function:

◆ getOptions()

Symfony\Component\Process\Process::getOptions ( )

Gets the options for proc_open.

Returns
array The current options

Definition at line 1127 of file Process.php.

References Symfony\Component\Process\Process\$options.

1128  {
1129  return $this->options;
1130  }

◆ getOutput()

Symfony\Component\Process\Process::getOutput ( )

Returns the current output of the process (STDOUT).

Returns
string The process output
Exceptions
LogicExceptionin case the output has been disabled
LogicExceptionIn case the process is not started

Definition at line 472 of file Process.php.

References $ret, and Symfony\Component\Process\Process\readPipesForOutput().

Referenced by Symfony\Component\Process\Exception\ProcessFailedException\__construct(), and Assetic\Exception\FilterException\fromProcess().

473  {
474  $this->readPipesForOutput(__FUNCTION__);
475 
476  if (false === $ret = stream_get_contents($this->stdout, -1, 0)) {
477  return '';
478  }
479 
480  return $ret;
481  }
readPipesForOutput($caller, $blocking=false)
Reads pipes for the freshest output.
Definition: Process.php:1355
$ret
Definition: parser.php:6
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getPid()

Symfony\Component\Process\Process::getPid ( )

Returns the Pid (process identifier), if applicable.

Returns
int|null The process id if running, null otherwise

Definition at line 391 of file Process.php.

References Symfony\Component\Process\Process\isRunning().

Referenced by Symfony\Component\Process\Process\doSignal().

392  {
393  return $this->isRunning() ? $this->processInformation['pid'] : null;
394  }
isRunning()
Checks if the process is currently running.
Definition: Process.php:764
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getStatus()

Symfony\Component\Process\Process::getStatus ( )

Gets the process status.

The status is one of: ready, started, terminated.

Returns
string The current process status

Definition at line 804 of file Process.php.

References Symfony\Component\Process\Process\$status, and Symfony\Component\Process\Process\updateStatus().

805  {
806  $this->updateStatus(false);
807 
808  return $this->status;
809  }
updateStatus($blocking)
Updates the status of the process, reads pipes.
Definition: Process.php:1306
+ Here is the call graph for this function:

◆ getStopSignal()

Symfony\Component\Process\Process::getStopSignal ( )

Returns the number of the signal that caused the child process to stop its execution.

It is only meaningful if hasBeenStopped() returns true.

Returns
int
Exceptions
LogicExceptionIn case the process is not terminated

Definition at line 752 of file Process.php.

References Symfony\Component\Process\Process\requireProcessIsTerminated().

753  {
754  $this->requireProcessIsTerminated(__FUNCTION__);
755 
756  return $this->processInformation['stopsig'];
757  }
requireProcessIsTerminated($functionName)
Ensures the process is terminated, throws a LogicException if the process has a status different than...
Definition: Process.php:1536
+ Here is the call graph for this function:

◆ getTermSignal()

Symfony\Component\Process\Process::getTermSignal ( )

Returns the number of the signal that caused the child process to terminate its execution.

It is only meaningful if hasBeenSignaled() returns true.

Returns
int
Exceptions
RuntimeExceptionIn case –enable-sigchild is activated
LogicExceptionIn case the process is not terminated

Definition at line 716 of file Process.php.

References Symfony\Component\Process\Process\isSigchildEnabled(), and Symfony\Component\Process\Process\requireProcessIsTerminated().

717  {
718  $this->requireProcessIsTerminated(__FUNCTION__);
719 
720  if ($this->isSigchildEnabled() && (!$this->enhanceSigchildCompatibility || -1 === $this->processInformation['termsig'])) {
721  throw new RuntimeException('This PHP has been compiled with --enable-sigchild. Term signal can not be retrieved.');
722  }
723 
724  return $this->processInformation['termsig'];
725  }
requireProcessIsTerminated($functionName)
Ensures the process is terminated, throws a LogicException if the process has a status different than...
Definition: Process.php:1536
isSigchildEnabled()
Returns whether PHP has been compiled with the &#39;–enable-sigchild&#39; option or not. ...
Definition: Process.php:1331
+ Here is the call graph for this function:

◆ getTimeout()

Symfony\Component\Process\Process::getTimeout ( )

Gets the process timeout (max.

runtime).

Returns
float|null The timeout in seconds or null if it's disabled

Definition at line 909 of file Process.php.

References Symfony\Component\Process\Process\$timeout.

910  {
911  return $this->timeout;
912  }

◆ getWorkingDirectory()

Symfony\Component\Process\Process::getWorkingDirectory ( )

Gets the working directory.

Returns
string|null The current working directory or null on failure

Definition at line 1027 of file Process.php.

References Symfony\Component\Process\Process\$cwd.

Referenced by Symfony\Component\Process\Exception\ProcessFailedException\__construct().

1028  {
1029  if (null === $this->cwd) {
1030  // getcwd() will return false if any one of the parent directories does not have
1031  // the readable or search mode set, even if the current directory does
1032  return getcwd() ?: null;
1033  }
1034 
1035  return $this->cwd;
1036  }
+ Here is the caller graph for this function:

◆ hasBeenSignaled()

Symfony\Component\Process\Process::hasBeenSignaled ( )

Returns true if the child process has been terminated by an uncaught signal.

It always returns false on Windows.

Returns
bool
Exceptions
RuntimeExceptionIn case –enable-sigchild is activated
LogicExceptionIn case the process is not terminated

Definition at line 695 of file Process.php.

References Symfony\Component\Process\Process\isSigchildEnabled(), and Symfony\Component\Process\Process\requireProcessIsTerminated().

696  {
697  $this->requireProcessIsTerminated(__FUNCTION__);
698 
699  if (!$this->enhanceSigchildCompatibility && $this->isSigchildEnabled()) {
700  throw new RuntimeException('This PHP has been compiled with --enable-sigchild. Term signal can not be retrieved.');
701  }
702 
703  return $this->processInformation['signaled'];
704  }
requireProcessIsTerminated($functionName)
Ensures the process is terminated, throws a LogicException if the process has a status different than...
Definition: Process.php:1536
isSigchildEnabled()
Returns whether PHP has been compiled with the &#39;–enable-sigchild&#39; option or not. ...
Definition: Process.php:1331
+ Here is the call graph for this function:

◆ hasBeenStopped()

Symfony\Component\Process\Process::hasBeenStopped ( )

Returns true if the child process has been stopped by a signal.

It always returns false on Windows.

Returns
bool
Exceptions
LogicExceptionIn case the process is not terminated

Definition at line 736 of file Process.php.

References Symfony\Component\Process\Process\requireProcessIsTerminated().

737  {
738  $this->requireProcessIsTerminated(__FUNCTION__);
739 
740  return $this->processInformation['stopped'];
741  }
requireProcessIsTerminated($functionName)
Ensures the process is terminated, throws a LogicException if the process has a status different than...
Definition: Process.php:1536
+ Here is the call graph for this function:

◆ isOutputDisabled()

Symfony\Component\Process\Process::isOutputDisabled ( )

Returns true in case the output is disabled, false otherwise.

Returns
bool

Definition at line 459 of file Process.php.

References Symfony\Component\Process\Process\$outputDisabled.

Referenced by Symfony\Component\Process\Exception\ProcessFailedException\__construct().

460  {
461  return $this->outputDisabled;
462  }
+ Here is the caller graph for this function:

◆ isPty()

Symfony\Component\Process\Process::isPty ( )

Returns PTY state.

Returns
bool

Definition at line 1017 of file Process.php.

References Symfony\Component\Process\Process\$pty.

Referenced by Symfony\Component\Process\Process\getDescriptors().

1018  {
1019  return $this->pty;
1020  }
+ Here is the caller graph for this function:

◆ isPtySupported()

static Symfony\Component\Process\Process::isPtySupported ( )
static

Returns whether PTY is supported on the current operating system.

Returns
bool

Definition at line 1232 of file Process.php.

References $result, and array.

Referenced by Symfony\Component\Process\Pipes\UnixPipes\getDescriptors(), and Symfony\Component\Process\Tests\ProcessTest\testPTYCommand().

1233  {
1234  static $result;
1235 
1236  if (null !== $result) {
1237  return $result;
1238  }
1239 
1240  if ('\\' === DIRECTORY_SEPARATOR) {
1241  return $result = false;
1242  }
1243 
1244  return $result = (bool) @proc_open('echo 1', array(array('pty'), array('pty'), array('pty')), $pipes);
1245  }
$result
Create styles array
The data for the language used.
+ Here is the caller graph for this function:

◆ isRunning()

Symfony\Component\Process\Process::isRunning ( )

Checks if the process is currently running.

Returns
bool true if the process is currently running, false otherwise

Definition at line 764 of file Process.php.

References Symfony\Component\Process\Process\updateStatus().

Referenced by Symfony\Component\Process\Process\disableOutput(), Symfony\Component\Process\Process\doSignal(), Symfony\Component\Process\Process\enableOutput(), Symfony\Component\Process\Process\getPid(), Symfony\Component\Process\Process\restart(), Symfony\Component\Process\Process\setInput(), Symfony\Component\Process\Process\start(), Symfony\Component\Process\Process\stop(), and Symfony\Component\Process\Process\wait().

765  {
766  if (self::STATUS_STARTED !== $this->status) {
767  return false;
768  }
769 
770  $this->updateStatus(false);
771 
772  return $this->processInformation['running'];
773  }
updateStatus($blocking)
Updates the status of the process, reads pipes.
Definition: Process.php:1306
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ isSigchildEnabled()

Symfony\Component\Process\Process::isSigchildEnabled ( )
protected

Returns whether PHP has been compiled with the '–enable-sigchild' option or not.

Returns
bool

Definition at line 1331 of file Process.php.

References defined.

Referenced by Symfony\Component\Process\Process\__construct(), Symfony\Component\Process\Process\close(), Symfony\Component\Process\Process\doSignal(), Symfony\Component\Process\Process\getExitCode(), Symfony\Component\Process\Process\getTermSignal(), Symfony\Component\Process\Process\hasBeenSignaled(), Symfony\Component\Process\Process\mustRun(), Symfony\Component\Process\Process\start(), and Symfony\Component\Process\Process\updateStatus().

1332  {
1333  if (null !== self::$sigchild) {
1334  return self::$sigchild;
1335  }
1336 
1337  if (!function_exists('phpinfo') || defined('HHVM_VERSION')) {
1338  return self::$sigchild = false;
1339  }
1340 
1341  ob_start();
1342  phpinfo(INFO_GENERAL);
1343 
1344  return self::$sigchild = false !== strpos(ob_get_clean(), '--enable-sigchild');
1345  }
defined( 'APPLICATION_ENV')||define( 'APPLICATION_ENV'
Definition: bootstrap.php:27
+ Here is the caller graph for this function:

◆ isStarted()

Symfony\Component\Process\Process::isStarted ( )

Checks if the process has been started with no regard to the current state.

Returns
bool true if status is ready, false otherwise

Definition at line 780 of file Process.php.

Referenced by Symfony\Component\Process\Process\requireProcessIsStarted().

781  {
782  return $this->status != self::STATUS_READY;
783  }
+ Here is the caller graph for this function:

◆ isSuccessful()

Symfony\Component\Process\Process::isSuccessful ( )

Checks if the process ended successfully.

Returns
bool true if the process ended successfully, false otherwise

Definition at line 680 of file Process.php.

References Symfony\Component\Process\Process\getExitCode().

Referenced by Symfony\Component\Process\Exception\ProcessFailedException\__construct().

681  {
682  return 0 === $this->getExitCode();
683  }
getExitCode()
Returns the exit code returned by the process.
Definition: Process.php:644
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ isTerminated()

Symfony\Component\Process\Process::isTerminated ( )

Checks if the process is terminated.

Returns
bool true if process is terminated, false otherwise

Definition at line 790 of file Process.php.

References Symfony\Component\Process\Process\updateStatus().

Referenced by Symfony\Component\Process\Process\requireProcessIsTerminated().

791  {
792  $this->updateStatus(false);
793 
794  return $this->status == self::STATUS_TERMINATED;
795  }
updateStatus($blocking)
Updates the status of the process, reads pipes.
Definition: Process.php:1306
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ isTty()

Symfony\Component\Process\Process::isTty ( )

Checks if the TTY mode is enabled.

Returns
bool true if the TTY mode is enabled, false otherwise

Definition at line 993 of file Process.php.

References Symfony\Component\Process\Process\$tty.

Referenced by Symfony\Component\Process\Process\getDescriptors().

994  {
995  return $this->tty;
996  }
+ Here is the caller graph for this function:

◆ mustRun()

Symfony\Component\Process\Process::mustRun ( callable  $callback = null)

Runs the process.

This is identical to run() except that an exception is thrown if the process exits with a non-zero exit code.

Parameters
callable | null$callback
Returns
self
Exceptions
RuntimeExceptionif PHP was compiled with –enable-sigchild and the enhanced sigchild compatibility mode is not enabled
ProcessFailedExceptionif the process didn't terminate successfully

Definition at line 225 of file Process.php.

References Symfony\Component\Process\Process\$callback, Symfony\Component\Process\Process\isSigchildEnabled(), and Symfony\Component\Process\Process\run().

226  {
227  if (!$this->enhanceSigchildCompatibility && $this->isSigchildEnabled()) {
228  throw new RuntimeException('This PHP has been compiled with --enable-sigchild. You must use setEnhanceSigchildCompatibility() to use this method.');
229  }
230 
231  if (0 !== $this->run($callback)) {
232  throw new ProcessFailedException($this);
233  }
234 
235  return $this;
236  }
run($callback=null)
Runs the process.
Definition: Process.php:205
isSigchildEnabled()
Returns whether PHP has been compiled with the &#39;–enable-sigchild&#39; option or not. ...
Definition: Process.php:1331
+ Here is the call graph for this function:

◆ readPipes()

Symfony\Component\Process\Process::readPipes (   $blocking,
  $close 
)
private

Reads pipes, executes callback.

Parameters
bool$blockingWhether to use blocking calls or not
bool$closeWhether to close file handles or not

Definition at line 1394 of file Process.php.

References Symfony\Component\Process\Process\$callback, $data, and $result.

Referenced by Symfony\Component\Process\Process\updateStatus(), and Symfony\Component\Process\Process\wait().

1395  {
1396  $result = $this->processPipes->readAndWrite($blocking, $close);
1397 
1399  foreach ($result as $type => $data) {
1400  if (3 !== $type) {
1401  $callback($type === self::STDOUT ? self::OUT : self::ERR, $data);
1402  } elseif (!isset($this->fallbackStatus['signaled'])) {
1403  $this->fallbackStatus['exitcode'] = (int) $data;
1404  }
1405  }
1406  }
$result
+ Here is the caller graph for this function:

◆ readPipesForOutput()

Symfony\Component\Process\Process::readPipesForOutput (   $caller,
  $blocking = false 
)
private

Reads pipes for the freshest output.

Parameters
string$callerThe name of the method that needs fresh outputs
bool$blockingWhether to use blocking calls or not
Exceptions
LogicExceptionin case output has been disabled or process is not started

Definition at line 1355 of file Process.php.

References Symfony\Component\Process\Process\requireProcessIsStarted(), and Symfony\Component\Process\Process\updateStatus().

Referenced by Symfony\Component\Process\Process\getErrorOutput(), Symfony\Component\Process\Process\getIncrementalErrorOutput(), Symfony\Component\Process\Process\getIncrementalOutput(), Symfony\Component\Process\Process\getIterator(), and Symfony\Component\Process\Process\getOutput().

1356  {
1357  if ($this->outputDisabled) {
1358  throw new LogicException('Output has been disabled.');
1359  }
1360 
1361  $this->requireProcessIsStarted($caller);
1362 
1363  $this->updateStatus($blocking);
1364  }
requireProcessIsStarted($functionName)
Ensures the process is running or terminated, throws a LogicException if the process has a not starte...
Definition: Process.php:1522
updateStatus($blocking)
Updates the status of the process, reads pipes.
Definition: Process.php:1306
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ requireProcessIsStarted()

Symfony\Component\Process\Process::requireProcessIsStarted (   $functionName)
private

Ensures the process is running or terminated, throws a LogicException if the process has a not started.

Parameters
string$functionNameThe function name that was called
Exceptions
LogicExceptionIf the process has not run.

Definition at line 1522 of file Process.php.

References Symfony\Component\Process\Process\isStarted().

Referenced by Symfony\Component\Process\Process\readPipesForOutput(), and Symfony\Component\Process\Process\wait().

1523  {
1524  if (!$this->isStarted()) {
1525  throw new LogicException(sprintf('Process must be started before calling %s.', $functionName));
1526  }
1527  }
isStarted()
Checks if the process has been started with no regard to the current state.
Definition: Process.php:780
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ requireProcessIsTerminated()

Symfony\Component\Process\Process::requireProcessIsTerminated (   $functionName)
private

Ensures the process is terminated, throws a LogicException if the process has a status different than terminated.

Parameters
string$functionNameThe function name that was called
Exceptions
LogicExceptionIf the process is not yet terminated.

Definition at line 1536 of file Process.php.

References Symfony\Component\Process\Process\isTerminated().

Referenced by Symfony\Component\Process\Process\getStopSignal(), Symfony\Component\Process\Process\getTermSignal(), Symfony\Component\Process\Process\hasBeenSignaled(), and Symfony\Component\Process\Process\hasBeenStopped().

1537  {
1538  if (!$this->isTerminated()) {
1539  throw new LogicException(sprintf('Process must be terminated before calling %s.', $functionName));
1540  }
1541  }
isTerminated()
Checks if the process is terminated.
Definition: Process.php:790
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ resetProcessData()

Symfony\Component\Process\Process::resetProcessData ( )
private

Resets data related to the latest run of the process.

Definition at line 1443 of file Process.php.

References array.

Referenced by Symfony\Component\Process\Process\__clone(), and Symfony\Component\Process\Process\start().

1444  {
1445  $this->starttime = null;
1446  $this->callback = null;
1447  $this->exitcode = null;
1448  $this->fallbackStatus = array();
1449  $this->processInformation = null;
1450  $this->stdout = fopen('php://temp/maxmemory:'.(1024 * 1024), 'wb+');
1451  $this->stderr = fopen('php://temp/maxmemory:'.(1024 * 1024), 'wb+');
1452  $this->process = null;
1453  $this->latestSignal = null;
1454  $this->status = self::STATUS_READY;
1455  $this->incrementalOutputOffset = 0;
1456  $this->incrementalErrorOutputOffset = 0;
1457  }
Create styles array
The data for the language used.
+ Here is the caller graph for this function:

◆ restart()

Symfony\Component\Process\Process::restart ( callable  $callback = null)

Restarts the process.

Be warned that the process is cloned before being started.

Parameters
callable | null$callbackA PHP callback to run whenever there is some output available on STDOUT or STDERR
Returns
Process The new process
Exceptions
RuntimeExceptionWhen process can't be launched
RuntimeExceptionWhen process is already running
See also
start()

Definition at line 328 of file Process.php.

References Symfony\Component\Process\Process\$callback, Symfony\Component\Process\Process\$process, and Symfony\Component\Process\Process\isRunning().

329  {
330  if ($this->isRunning()) {
331  throw new RuntimeException('Process is already running');
332  }
333 
334  $process = clone $this;
335  $process->start($callback);
336 
337  return $process;
338  }
isRunning()
Checks if the process is currently running.
Definition: Process.php:764
+ Here is the call graph for this function:

◆ run()

Symfony\Component\Process\Process::run (   $callback = null)

Runs the process.

The callback receives the type of output (out or err) and some bytes from the output in real-time. It allows to have feedback from the independent process during execution.

The STDOUT and STDERR are also available after the process is finished via the getOutput() and getErrorOutput() methods.

Parameters
callable | null$callbackA PHP callback to run whenever there is some output available on STDOUT or STDERR
Returns
int The exit status code
Exceptions
RuntimeExceptionWhen process can't be launched
RuntimeExceptionWhen process stopped after receiving signal
LogicExceptionIn case a callback is provided and output has been disabled

Definition at line 205 of file Process.php.

References Symfony\Component\Process\Process\$callback, Symfony\Component\Process\Process\start(), and Symfony\Component\Process\Process\wait().

Referenced by Symfony\Component\Process\Process\mustRun().

206  {
207  $this->start($callback);
208 
209  return $this->wait();
210  }
wait(callable $callback=null)
Waits for the process to terminate.
Definition: Process.php:355
start(callable $callback=null)
Starts the process and returns after writing the input to STDIN.
Definition: Process.php:257
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ setCommandLine()

Symfony\Component\Process\Process::setCommandLine (   $commandline)

Sets the command line to be executed.

Parameters
string$commandlineThe command to execute
Returns
self The current Process instance

Definition at line 897 of file Process.php.

References Symfony\Component\Process\Process\$commandline.

Referenced by Symfony\Component\Process\PhpProcess\setPhpBinary().

898  {
899  $this->commandline = $commandline;
900 
901  return $this;
902  }
+ Here is the caller graph for this function:

◆ setEnhanceSigchildCompatibility()

Symfony\Component\Process\Process::setEnhanceSigchildCompatibility (   $enhance)

Activates sigchild compatibility mode.

Sigchild compatibility mode is required to get the exit code and determine the success of a process when PHP has been compiled with the –enable-sigchild option

Parameters
bool$enhance
Returns
self The current Process instance

Definition at line 1193 of file Process.php.

1194  {
1195  $this->enhanceSigchildCompatibility = (bool) $enhance;
1196 
1197  return $this;
1198  }

◆ setEnhanceWindowsCompatibility()

Symfony\Component\Process\Process::setEnhanceWindowsCompatibility (   $enhance)

Sets whether or not Windows compatibility is enabled.

Parameters
bool$enhance
Returns
self The current Process instance

Definition at line 1165 of file Process.php.

1166  {
1167  $this->enhanceWindowsCompatibility = (bool) $enhance;
1168 
1169  return $this;
1170  }

◆ setEnv()

Symfony\Component\Process\Process::setEnv ( array  $env)

Sets the environment variables.

An environment variable value should be a string. If it is an array, the variable is ignored.

That happens in PHP when 'argv' is registered into the $_ENV array for instance.

Parameters
array$envThe new environment variables
Returns
self The current Process instance

Definition at line 1075 of file Process.php.

References array, and string.

Referenced by Symfony\Component\Process\Process\__construct().

1076  {
1077  // Process can not handle env values that are arrays
1078  $env = array_filter($env, function ($value) {
1079  return !is_array($value);
1080  });
1081 
1082  $this->env = array();
1083  foreach ($env as $key => $value) {
1084  $this->env[$key] = (string) $value;
1085  }
1086 
1087  return $this;
1088  }
Add rich text string
The name of the decorator.
Create styles array
The data for the language used.
+ Here is the caller graph for this function:

◆ setIdleTimeout()

Symfony\Component\Process\Process::setIdleTimeout (   $timeout)

Sets the process idle timeout (max.

time since last output).

To disable the timeout, set this value to null.

Parameters
int | float | null$timeoutThe timeout in seconds
Returns
self The current Process instance
Exceptions
LogicExceptionif the output is disabled
InvalidArgumentExceptionif the timeout is negative

Definition at line 954 of file Process.php.

References Symfony\Component\Process\Process\$timeout, and Symfony\Component\Process\Process\validateTimeout().

955  {
956  if (null !== $timeout && $this->outputDisabled) {
957  throw new LogicException('Idle timeout can not be set while the output is disabled.');
958  }
959 
960  $this->idleTimeout = $this->validateTimeout($timeout);
961 
962  return $this;
963  }
validateTimeout($timeout)
Validates and returns the filtered timeout.
Definition: Process.php:1375
+ Here is the call graph for this function:

◆ setInput()

Symfony\Component\Process\Process::setInput (   $input)

Sets the input.

This content will be passed to the underlying process standard input.

Parameters
resource | scalar | \Traversable | null$inputThe content
Returns
self The current Process instance
Exceptions
LogicExceptionIn case the process is running

Definition at line 1111 of file Process.php.

References Symfony\Component\Process\Process\$input, input, Symfony\Component\Process\Process\isRunning(), and Symfony\Component\Process\ProcessUtils\validateInput().

Referenced by Symfony\Component\Process\Process\__construct().

1112  {
1113  if ($this->isRunning()) {
1114  throw new LogicException('Input can not be set while the process is running.');
1115  }
1116 
1117  $this->input = ProcessUtils::validateInput(__METHOD__, $input);
1118 
1119  return $this;
1120  }
input
Definition: langcheck.php:166
isRunning()
Checks if the process is currently running.
Definition: Process.php:764
static validateInput($caller, $input)
Validates and normalizes a Process input.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ setOptions()

Symfony\Component\Process\Process::setOptions ( array  $options)

Sets the options for proc_open.

Parameters
array$optionsThe new options
Returns
self The current Process instance

Definition at line 1139 of file Process.php.

References Symfony\Component\Process\Process\$options.

1140  {
1141  $this->options = $options;
1142 
1143  return $this;
1144  }

◆ setPty()

Symfony\Component\Process\Process::setPty (   $bool)

Sets PTY mode.

Parameters
bool$bool
Returns
self

Definition at line 1005 of file Process.php.

1006  {
1007  $this->pty = (bool) $bool;
1008 
1009  return $this;
1010  }

◆ setTimeout()

Symfony\Component\Process\Process::setTimeout (   $timeout)

Sets the process timeout (max.

runtime).

To disable the timeout, set this value to null.

Parameters
int | float | null$timeoutThe timeout in seconds
Returns
self The current Process instance
Exceptions
InvalidArgumentExceptionif the timeout is negative

Definition at line 935 of file Process.php.

References Symfony\Component\Process\Process\$timeout, and Symfony\Component\Process\Process\validateTimeout().

Referenced by Symfony\Component\Process\Process\__construct().

936  {
937  $this->timeout = $this->validateTimeout($timeout);
938 
939  return $this;
940  }
validateTimeout($timeout)
Validates and returns the filtered timeout.
Definition: Process.php:1375
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ setTty()

Symfony\Component\Process\Process::setTty (   $tty)

Enables or disables the TTY mode.

Parameters
bool$ttyTrue to enabled and false to disable
Returns
self The current Process instance
Exceptions
RuntimeExceptionIn case the TTY mode is not supported

Definition at line 974 of file Process.php.

References Symfony\Component\Process\Process\$tty.

975  {
976  if ('\\' === DIRECTORY_SEPARATOR && $tty) {
977  throw new RuntimeException('TTY mode is not supported on Windows platform.');
978  }
979  if ($tty && (!file_exists('/dev/tty') || !is_readable('/dev/tty'))) {
980  throw new RuntimeException('TTY mode requires /dev/tty to be readable.');
981  }
982 
983  $this->tty = (bool) $tty;
984 
985  return $this;
986  }

◆ setWorkingDirectory()

Symfony\Component\Process\Process::setWorkingDirectory (   $cwd)

Sets the current working directory.

Parameters
string$cwdThe new working directory
Returns
self The current Process instance

Definition at line 1045 of file Process.php.

References Symfony\Component\Process\Process\$cwd.

1046  {
1047  $this->cwd = $cwd;
1048 
1049  return $this;
1050  }

◆ signal()

Symfony\Component\Process\Process::signal (   $signal)

Sends a POSIX signal to the process.

Parameters
int$signalA valid POSIX signal (see http://www.php.net/manual/en/pcntl.constants.php)
Returns
Process
Exceptions
LogicExceptionIn case the process is not running
RuntimeExceptionIn case –enable-sigchild is activated and the process can't be killed
RuntimeExceptionIn case of failure

Definition at line 407 of file Process.php.

References Symfony\Component\Process\Process\doSignal().

408  {
409  $this->doSignal($signal, true);
410 
411  return $this;
412  }
doSignal($signal, $throwException)
Sends a POSIX signal to the process.
Definition: Process.php:1471
+ Here is the call graph for this function:

◆ start()

Symfony\Component\Process\Process::start ( callable  $callback = null)

Starts the process and returns after writing the input to STDIN.

This method blocks until all STDIN data is sent to the process then it returns while the process runs in the background.

The termination of the process can be awaited with wait().

The callback receives the type of output (out or err) and some bytes from the output in real-time while writing the standard input to the process. It allows to have feedback from the independent process during execution.

Parameters
callable | null$callbackA PHP callback to run whenever there is some output available on STDOUT or STDERR
Exceptions
RuntimeExceptionWhen process can't be launched
RuntimeExceptionWhen process is already running
LogicExceptionIn case a callback is provided and output has been disabled

Definition at line 257 of file Process.php.

References Symfony\Component\Process\Process\$callback, Symfony\Component\Process\Process\$commandline, $filename, array, Symfony\Component\Process\Process\buildCallback(), Symfony\Component\Process\Process\checkTimeout(), Symfony\Component\Process\ProcessUtils\escapeArgument(), Symfony\Component\Process\Process\getDescriptors(), Symfony\Component\Process\Process\isRunning(), Symfony\Component\Process\Process\isSigchildEnabled(), Symfony\Component\Process\Process\resetProcessData(), and Symfony\Component\Process\Process\updateStatus().

Referenced by Symfony\Component\Process\Process\run().

258  {
259  if ($this->isRunning()) {
260  throw new RuntimeException('Process is already running');
261  }
262 
263  $this->resetProcessData();
264  $this->starttime = $this->lastOutputTime = microtime(true);
265  $this->callback = $this->buildCallback($callback);
266  $this->hasCallback = null !== $callback;
267  $descriptors = $this->getDescriptors();
268 
270 
271  if ('\\' === DIRECTORY_SEPARATOR && $this->enhanceWindowsCompatibility) {
272  $commandline = 'cmd /V:ON /E:ON /D /C "('.$commandline.')';
273  foreach ($this->processPipes->getFiles() as $offset => $filename) {
275  }
276  $commandline .= '"';
277 
278  if (!isset($this->options['bypass_shell'])) {
279  $this->options['bypass_shell'] = true;
280  }
281  } elseif (!$this->useFileHandles && $this->enhanceSigchildCompatibility && $this->isSigchildEnabled()) {
282  // last exit code is output on the fourth pipe and caught to work around --enable-sigchild
283  $descriptors[3] = array('pipe', 'w');
284 
285  // See https://unix.stackexchange.com/questions/71205/background-process-pipe-input
286  $commandline = '{ ('.$this->commandline.') <&3 3<&- 3>/dev/null & } 3<&0;';
287  $commandline .= 'pid=$!; echo $pid >&3; wait $pid; code=$?; echo $code >&3; exit $code';
288 
289  // Workaround for the bug, when PTS functionality is enabled.
290  // @see : https://bugs.php.net/69442
291  $ptsWorkaround = fopen(__FILE__, 'r');
292  }
293 
294  $this->process = proc_open($commandline, $descriptors, $this->processPipes->pipes, $this->cwd, $this->env, $this->options);
295 
296  if (!is_resource($this->process)) {
297  throw new RuntimeException('Unable to launch a new process.');
298  }
299  $this->status = self::STATUS_STARTED;
300 
301  if (isset($descriptors[3])) {
302  $this->fallbackStatus['pid'] = (int) fgets($this->processPipes->pipes[3]);
303  }
304 
305  if ($this->tty) {
306  return;
307  }
308 
309  $this->updateStatus(false);
310  $this->checkTimeout();
311  }
resetProcessData()
Resets data related to the latest run of the process.
Definition: Process.php:1443
updateStatus($blocking)
Updates the status of the process, reads pipes.
Definition: Process.php:1306
isRunning()
Checks if the process is currently running.
Definition: Process.php:764
checkTimeout()
Performs a check between the timeout definition and the time the process started. ...
Definition: Process.php:1208
Create styles array
The data for the language used.
static escapeArgument($argument)
Escapes a string to be used as a shell argument.
isSigchildEnabled()
Returns whether PHP has been compiled with the &#39;–enable-sigchild&#39; option or not. ...
Definition: Process.php:1331
buildCallback(callable $callback=null)
Builds up the callback used by wait().
Definition: Process.php:1276
getDescriptors()
Creates the descriptors needed by the proc_open.
Definition: Process.php:1252
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ stop()

Symfony\Component\Process\Process::stop (   $timeout = 10,
  $signal = null 
)

Stops the process.

Parameters
int | float$timeoutThe timeout in seconds
int$signalA POSIX signal to send in case the process has not stop at timeout, default is SIGKILL (9)
Returns
int The exit-code of the process

Definition at line 819 of file Process.php.

References Symfony\Component\Process\Process\$exitcode, Symfony\Component\Process\Process\$timeout, Symfony\Component\Process\Process\close(), Symfony\Component\Process\Process\doSignal(), and Symfony\Component\Process\Process\isRunning().

Referenced by Symfony\Component\Process\Process\__destruct(), Symfony\Component\Process\Process\checkTimeout(), and Symfony\Component\Process\Process\wait().

820  {
821  $timeoutMicro = microtime(true) + $timeout;
822  if ($this->isRunning()) {
823  // given `SIGTERM` may not be defined and that `proc_terminate` uses the constant value and not the constant itself, we use the same here
824  $this->doSignal(15, false);
825  do {
826  usleep(1000);
827  } while ($this->isRunning() && microtime(true) < $timeoutMicro);
828 
829  if ($this->isRunning()) {
830  // Avoid exception here: process is supposed to be running, but it might have stopped just
831  // after this line. In any case, let's silently discard the error, we cannot do anything.
832  $this->doSignal($signal ?: 9, false);
833  }
834  }
835 
836  if ($this->isRunning()) {
837  if (isset($this->fallbackStatus['pid'])) {
838  unset($this->fallbackStatus['pid']);
839 
840  return $this->stop(0, $signal);
841  }
842  $this->close();
843  }
844 
845  return $this->exitcode;
846  }
doSignal($signal, $throwException)
Sends a POSIX signal to the process.
Definition: Process.php:1471
isRunning()
Checks if the process is currently running.
Definition: Process.php:764
close()
Closes process resource, closes file handles, sets the exitcode.
Definition: Process.php:1413
stop($timeout=10, $signal=null)
Stops the process.
Definition: Process.php:819
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ updateStatus()

Symfony\Component\Process\Process::updateStatus (   $blocking)
protected

Updates the status of the process, reads pipes.

Parameters
bool$blockingWhether to use a blocking read call

Definition at line 1306 of file Process.php.

References Symfony\Component\Process\Process\$processInformation, Symfony\Component\Process\Process\close(), Symfony\Component\Process\Process\isSigchildEnabled(), and Symfony\Component\Process\Process\readPipes().

Referenced by Symfony\Component\Process\Process\getExitCode(), Symfony\Component\Process\Process\getStatus(), Symfony\Component\Process\Process\isRunning(), Symfony\Component\Process\Process\isTerminated(), Symfony\Component\Process\Process\readPipesForOutput(), Symfony\Component\Process\Process\start(), and Symfony\Component\Process\Process\wait().

1307  {
1308  if (self::STATUS_STARTED !== $this->status) {
1309  return;
1310  }
1311 
1312  $this->processInformation = proc_get_status($this->process);
1313  $running = $this->processInformation['running'];
1314 
1315  $this->readPipes($running && $blocking, '\\' !== DIRECTORY_SEPARATOR || !$running);
1316 
1317  if ($this->fallbackStatus && $this->enhanceSigchildCompatibility && $this->isSigchildEnabled()) {
1318  $this->processInformation = $this->fallbackStatus + $this->processInformation;
1319  }
1320 
1321  if (!$running) {
1322  $this->close();
1323  }
1324  }
readPipes($blocking, $close)
Reads pipes, executes callback.
Definition: Process.php:1394
close()
Closes process resource, closes file handles, sets the exitcode.
Definition: Process.php:1413
isSigchildEnabled()
Returns whether PHP has been compiled with the &#39;–enable-sigchild&#39; option or not. ...
Definition: Process.php:1331
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ validateTimeout()

Symfony\Component\Process\Process::validateTimeout (   $timeout)
private

Validates and returns the filtered timeout.

Parameters
int | float | null$timeout
Returns
float|null
Exceptions
InvalidArgumentExceptionif the given timeout is a negative number

Definition at line 1375 of file Process.php.

References Symfony\Component\Process\Process\$timeout.

Referenced by Symfony\Component\Process\Process\setIdleTimeout(), and Symfony\Component\Process\Process\setTimeout().

1376  {
1377  $timeout = (float) $timeout;
1378 
1379  if (0.0 === $timeout) {
1380  $timeout = null;
1381  } elseif ($timeout < 0) {
1382  throw new InvalidArgumentException('The timeout value must be a valid positive integer or float number.');
1383  }
1384 
1385  return $timeout;
1386  }
+ Here is the caller graph for this function:

◆ wait()

Symfony\Component\Process\Process::wait ( callable  $callback = null)

Waits for the process to terminate.

The callback receives the type of output (out or err) and some bytes from the output in real-time while writing the standard input to the process. It allows to have feedback from the independent process during execution.

Parameters
callable | null$callbackA valid PHP callback
Returns
int The exitcode of the process
Exceptions
RuntimeExceptionWhen process timed out
RuntimeExceptionWhen process stopped after receiving signal
LogicExceptionWhen process is not yet started

Definition at line 355 of file Process.php.

References Symfony\Component\Process\Process\$callback, Symfony\Component\Process\Process\$exitcode, Symfony\Component\Process\Process\buildCallback(), Symfony\Component\Process\Process\checkTimeout(), Symfony\Component\Process\Process\isRunning(), Symfony\Component\Process\Process\readPipes(), Symfony\Component\Process\Process\requireProcessIsStarted(), Symfony\Component\Process\Process\stop(), and Symfony\Component\Process\Process\updateStatus().

Referenced by Symfony\Component\Process\Process\run().

356  {
357  $this->requireProcessIsStarted(__FUNCTION__);
358 
359  $this->updateStatus(false);
360 
361  if (null !== $callback) {
362  if (!$this->processPipes->haveReadSupport()) {
363  $this->stop(0);
364  throw new \LogicException('Pass the callback to the Process:start method or enableOutput to use a callback with Process::wait');
365  }
366  $this->callback = $this->buildCallback($callback);
367  }
368 
369  do {
370  $this->checkTimeout();
371  $running = '\\' === DIRECTORY_SEPARATOR ? $this->isRunning() : $this->processPipes->areOpen();
372  $this->readPipes($running, '\\' !== DIRECTORY_SEPARATOR || !$running);
373  } while ($running);
374 
375  while ($this->isRunning()) {
376  usleep(1000);
377  }
378 
379  if ($this->processInformation['signaled'] && $this->processInformation['termsig'] !== $this->latestSignal) {
380  throw new RuntimeException(sprintf('The process has been signaled with signal "%s".', $this->processInformation['termsig']));
381  }
382 
383  return $this->exitcode;
384  }
requireProcessIsStarted($functionName)
Ensures the process is running or terminated, throws a LogicException if the process has a not starte...
Definition: Process.php:1522
readPipes($blocking, $close)
Reads pipes, executes callback.
Definition: Process.php:1394
updateStatus($blocking)
Updates the status of the process, reads pipes.
Definition: Process.php:1306
isRunning()
Checks if the process is currently running.
Definition: Process.php:764
checkTimeout()
Performs a check between the timeout definition and the time the process started. ...
Definition: Process.php:1208
buildCallback(callable $callback=null)
Builds up the callback used by wait().
Definition: Process.php:1276
stop($timeout=10, $signal=null)
Stops the process.
Definition: Process.php:819
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

Field Documentation

◆ $callback

◆ $commandline

◆ $cwd

◆ $enhanceSigchildCompatibility

Symfony\Component\Process\Process::$enhanceSigchildCompatibility
private

◆ $enhanceWindowsCompatibility

Symfony\Component\Process\Process::$enhanceWindowsCompatibility = true
private

◆ $env

Symfony\Component\Process\Process::$env
private

◆ $exitcode

◆ $exitCodes

Symfony\Component\Process\Process::$exitCodes
static

Definition at line 92 of file Process.php.

◆ $fallbackStatus

Symfony\Component\Process\Process::$fallbackStatus = array()
private

Definition at line 63 of file Process.php.

◆ $hasCallback

Symfony\Component\Process\Process::$hasCallback = false
private

Definition at line 52 of file Process.php.

◆ $idleTimeout

Symfony\Component\Process\Process::$idleTimeout
private

Definition at line 60 of file Process.php.

Referenced by Symfony\Component\Process\Process\getIdleTimeout().

◆ $incrementalErrorOutputOffset

Symfony\Component\Process\Process::$incrementalErrorOutputOffset = 0
private

Definition at line 73 of file Process.php.

◆ $incrementalOutputOffset

Symfony\Component\Process\Process::$incrementalOutputOffset = 0
private

Definition at line 72 of file Process.php.

◆ $input

Symfony\Component\Process\Process::$input
private

◆ $lastOutputTime

Symfony\Component\Process\Process::$lastOutputTime
private

Definition at line 58 of file Process.php.

◆ $latestSignal

Symfony\Component\Process\Process::$latestSignal
private

Definition at line 81 of file Process.php.

Referenced by Symfony\Component\Process\Process\doSignal().

◆ $options

◆ $outputDisabled

Symfony\Component\Process\Process::$outputDisabled = false
private

Definition at line 65 of file Process.php.

Referenced by Symfony\Component\Process\Process\isOutputDisabled().

◆ $process

Symfony\Component\Process\Process::$process
private

Definition at line 70 of file Process.php.

Referenced by Symfony\Component\Process\Process\restart().

◆ $processInformation

Symfony\Component\Process\Process::$processInformation
private

Definition at line 64 of file Process.php.

Referenced by Symfony\Component\Process\Process\updateStatus().

◆ $processPipes

Symfony\Component\Process\Process::$processPipes
private

Definition at line 79 of file Process.php.

◆ $pty

Symfony\Component\Process\Process::$pty
private

Definition at line 75 of file Process.php.

Referenced by Symfony\Component\Process\Process\isPty().

◆ $sigchild

Symfony\Component\Process\Process::$sigchild
staticprivate

Definition at line 83 of file Process.php.

◆ $starttime

Symfony\Component\Process\Process::$starttime
private

Definition at line 57 of file Process.php.

◆ $status

Symfony\Component\Process\Process::$status = self::STATUS_READY
private

Definition at line 71 of file Process.php.

Referenced by Symfony\Component\Process\Process\getStatus().

◆ $stderr

Symfony\Component\Process\Process::$stderr
private

Definition at line 67 of file Process.php.

◆ $stdout

Symfony\Component\Process\Process::$stdout
private

Definition at line 66 of file Process.php.

◆ $timeout

◆ $tty

Symfony\Component\Process\Process::$tty
private

◆ $useFileHandles

Symfony\Component\Process\Process::$useFileHandles = false
private

Definition at line 77 of file Process.php.

◆ ERR

const Symfony\Component\Process\Process::ERR = 'err'

◆ ITER_KEEP_OUTPUT

const Symfony\Component\Process\Process::ITER_KEEP_OUTPUT = 2

Definition at line 47 of file Process.php.

◆ ITER_NON_BLOCKING

const Symfony\Component\Process\Process::ITER_NON_BLOCKING = 1

Definition at line 46 of file Process.php.

◆ ITER_SKIP_ERR

const Symfony\Component\Process\Process::ITER_SKIP_ERR = 8

Definition at line 49 of file Process.php.

◆ ITER_SKIP_OUT

const Symfony\Component\Process\Process::ITER_SKIP_OUT = 4

Definition at line 48 of file Process.php.

◆ OUT

const Symfony\Component\Process\Process::OUT = 'out'

◆ STATUS_READY

const Symfony\Component\Process\Process::STATUS_READY = 'ready'

Definition at line 35 of file Process.php.

Referenced by Symfony\Component\Process\Tests\ProcessTest\testStatus().

◆ STATUS_STARTED

const Symfony\Component\Process\Process::STATUS_STARTED = 'started'

Definition at line 36 of file Process.php.

Referenced by Symfony\Component\Process\Tests\ProcessTest\testStatus().

◆ STATUS_TERMINATED

const Symfony\Component\Process\Process::STATUS_TERMINATED = 'terminated'

◆ STDERR

const Symfony\Component\Process\Process::STDERR = 2

◆ STDIN

const Symfony\Component\Process\Process::STDIN = 0

Definition at line 39 of file Process.php.

◆ STDOUT

const Symfony\Component\Process\Process::STDOUT = 1

◆ TIMEOUT_PRECISION

const Symfony\Component\Process\Process::TIMEOUT_PRECISION = 0.2

The documentation for this class was generated from the following file: