ILIAS
release_5-2 Revision v5.2.25-18-g3f80b828510
|
Process is a thin wrapper around proc_* functions to easily start independent PHP processes. More...
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 |
Process is a thin wrapper around proc_* functions to easily start independent PHP processes.
Definition at line 30 of file Process.php.
Symfony\Component\Process\Process::__construct | ( | $commandline, | |
$cwd = null , |
|||
array | $env = null , |
||
$input = null , |
|||
$timeout = 60 , |
|||
array | $options = array() |
||
) |
Constructor.
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 |
mixed | null | $input | The input as stream resource, scalar or , or null for no input |
int | float | null | $timeout | The timeout in seconds or null to disable |
array | $options | An array of options for proc_open |
RuntimeException | When 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().
Symfony\Component\Process\Process::__destruct | ( | ) |
Definition at line 176 of file Process.php.
References Symfony\Component\Process\Process\stop().
Symfony\Component\Process\Process::__clone | ( | ) |
Definition at line 181 of file Process.php.
References Symfony\Component\Process\Process\resetProcessData().
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().
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().
|
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.
callable | null | $callback | The user defined PHP callback |
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().
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
ProcessTimedOutException | In 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().
Symfony\Component\Process\Process::clearErrorOutput | ( | ) |
Clears the process output.
Definition at line 628 of file Process.php.
Referenced by Symfony\Component\Process\Process\getIterator().
Symfony\Component\Process\Process::clearOutput | ( | ) |
Clears the process output.
Definition at line 569 of file Process.php.
Referenced by Symfony\Component\Process\Process\getIterator().
|
private |
Closes process resource, closes file handles, sets 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().
Symfony\Component\Process\Process::disableOutput | ( | ) |
Disables fetching output and error output from the underlying process.
RuntimeException | In case the process is already running |
LogicException | if an idle timeout is set |
Definition at line 422 of file Process.php.
References Symfony\Component\Process\Process\isRunning().
|
private |
Sends a POSIX signal to the process.
int | $signal | A valid POSIX signal (see http://www.php.net/manual/en/pcntl.constants.php) |
bool | $throwException | Whether to throw exception in case signal failed |
LogicException | In case the process is not running |
RuntimeException | In case –enable-sigchild is activated and the process can't be killed |
RuntimeException | In 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().
Symfony\Component\Process\Process::enableOutput | ( | ) |
Enables fetching output and error output from the underlying process.
RuntimeException | In case the process is already running |
Definition at line 443 of file Process.php.
References Symfony\Component\Process\Process\isRunning().
Symfony\Component\Process\Process::getCommandLine | ( | ) |
Gets the command line to be executed.
Definition at line 885 of file Process.php.
References Symfony\Component\Process\Process\$commandline.
Referenced by Symfony\Component\Process\Exception\ProcessFailedException\__construct(), Symfony\Component\Process\Exception\ProcessTimedOutException\__construct(), Assetic\Exception\FilterException\fromProcess(), Symfony\Component\Process\PhpProcess\start(), and Symfony\Component\Process\Tests\PhpProcessTest\testCommandLine().
|
private |
Creates the descriptors needed by the proc_open.
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().
Symfony\Component\Process\Process::getEnhanceSigchildCompatibility | ( | ) |
Returns whether sigchild compatibility mode is activated or not.
Definition at line 1177 of file Process.php.
References Symfony\Component\Process\Process\$enhanceSigchildCompatibility.
Symfony\Component\Process\Process::getEnhanceWindowsCompatibility | ( | ) |
Gets whether or not Windows compatibility is enabled.
This is true by default.
Definition at line 1153 of file Process.php.
References Symfony\Component\Process\Process\$enhanceWindowsCompatibility.
Symfony\Component\Process\Process::getEnv | ( | ) |
Gets the environment variables.
Definition at line 1057 of file Process.php.
References Symfony\Component\Process\Process\$env.
Symfony\Component\Process\Process::getErrorOutput | ( | ) |
Returns the current error output of the process (STDERR).
LogicException | in case the output has been disabled |
LogicException | In 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().
Symfony\Component\Process\Process::getExitCode | ( | ) |
Returns the exit code returned by the process.
RuntimeException | In 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().
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.
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().
Symfony\Component\Process\Process::getIdleTimeout | ( | ) |
Gets the process idle timeout (max.
time since last output).
Definition at line 919 of file Process.php.
References Symfony\Component\Process\Process\$idleTimeout.
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.
LogicException | in case the output has been disabled |
LogicException | In case the process is not started |
Definition at line 609 of file Process.php.
References Symfony\Component\Process\Process\readPipesForOutput().
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.
LogicException | in case the output has been disabled |
LogicException | In case the process is not started |
Definition at line 494 of file Process.php.
References Symfony\Component\Process\Process\readPipesForOutput().
Symfony\Component\Process\Process::getInput | ( | ) |
Gets the Process input.
Definition at line 1095 of file Process.php.
References Symfony\Component\Process\Process\$input.
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).
int | $flags | A bit field of Process::ITER_* flags |
LogicException | in case the output has been disabled |
LogicException | In case the process is not started |
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().
Symfony\Component\Process\Process::getOptions | ( | ) |
Gets the options for proc_open.
Definition at line 1127 of file Process.php.
References Symfony\Component\Process\Process\$options.
Symfony\Component\Process\Process::getOutput | ( | ) |
Returns the current output of the process (STDOUT).
LogicException | in case the output has been disabled |
LogicException | In 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().
Symfony\Component\Process\Process::getPid | ( | ) |
Returns the Pid (process identifier), if applicable.
Definition at line 391 of file Process.php.
References Symfony\Component\Process\Process\isRunning().
Referenced by Symfony\Component\Process\Process\doSignal().
Symfony\Component\Process\Process::getStatus | ( | ) |
Gets the process status.
The status is one of: ready, started, terminated.
Definition at line 804 of file Process.php.
References Symfony\Component\Process\Process\$status, and Symfony\Component\Process\Process\updateStatus().
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.
LogicException | In case the process is not terminated |
Definition at line 752 of file Process.php.
References Symfony\Component\Process\Process\requireProcessIsTerminated().
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.
RuntimeException | In case –enable-sigchild is activated |
LogicException | In 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().
Symfony\Component\Process\Process::getTimeout | ( | ) |
Gets the process timeout (max.
runtime).
Definition at line 909 of file Process.php.
References Symfony\Component\Process\Process\$timeout.
Symfony\Component\Process\Process::getWorkingDirectory | ( | ) |
Gets the working directory.
Definition at line 1027 of file Process.php.
References Symfony\Component\Process\Process\$cwd.
Referenced by Symfony\Component\Process\Exception\ProcessFailedException\__construct().
Symfony\Component\Process\Process::hasBeenSignaled | ( | ) |
Returns true if the child process has been terminated by an uncaught signal.
It always returns false on Windows.
RuntimeException | In case –enable-sigchild is activated |
LogicException | In 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().
Symfony\Component\Process\Process::hasBeenStopped | ( | ) |
Returns true if the child process has been stopped by a signal.
It always returns false on Windows.
LogicException | In case the process is not terminated |
Definition at line 736 of file Process.php.
References Symfony\Component\Process\Process\requireProcessIsTerminated().
Symfony\Component\Process\Process::isOutputDisabled | ( | ) |
Returns true in case the output is disabled, false otherwise.
Definition at line 459 of file Process.php.
References Symfony\Component\Process\Process\$outputDisabled.
Referenced by Symfony\Component\Process\Exception\ProcessFailedException\__construct().
Symfony\Component\Process\Process::isPty | ( | ) |
Returns PTY state.
Definition at line 1017 of file Process.php.
References Symfony\Component\Process\Process\$pty.
Referenced by Symfony\Component\Process\Process\getDescriptors().
|
static |
Returns whether PTY is supported on the current operating system.
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().
Symfony\Component\Process\Process::isRunning | ( | ) |
Checks if the process is currently running.
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().
|
protected |
Returns whether PHP has been compiled with the '–enable-sigchild' option or not.
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().
Symfony\Component\Process\Process::isStarted | ( | ) |
Checks if the process has been started with no regard to the current state.
Definition at line 780 of file Process.php.
Referenced by Symfony\Component\Process\Process\requireProcessIsStarted().
Symfony\Component\Process\Process::isSuccessful | ( | ) |
Checks if the process ended successfully.
Definition at line 680 of file Process.php.
References Symfony\Component\Process\Process\getExitCode().
Referenced by Symfony\Component\Process\Exception\ProcessFailedException\__construct().
Symfony\Component\Process\Process::isTerminated | ( | ) |
Checks if the process is terminated.
Definition at line 790 of file Process.php.
References Symfony\Component\Process\Process\updateStatus().
Referenced by Symfony\Component\Process\Process\requireProcessIsTerminated().
Symfony\Component\Process\Process::isTty | ( | ) |
Checks if the TTY mode is enabled.
Definition at line 993 of file Process.php.
References Symfony\Component\Process\Process\$tty.
Referenced by Symfony\Component\Process\Process\getDescriptors().
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.
callable | null | $callback |
RuntimeException | if PHP was compiled with –enable-sigchild and the enhanced sigchild compatibility mode is not enabled |
ProcessFailedException | if 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().
|
private |
Reads pipes, executes callback.
bool | $blocking | Whether to use blocking calls or not |
bool | $close | Whether 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().
|
private |
Reads pipes for the freshest output.
string | $caller | The name of the method that needs fresh outputs |
bool | $blocking | Whether to use blocking calls or not |
LogicException | in 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().
|
private |
Ensures the process is running or terminated, throws a LogicException if the process has a not started.
string | $functionName | The function name that was called |
LogicException | If 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().
|
private |
Ensures the process is terminated, throws a LogicException if the process has a status different than terminated
.
string | $functionName | The function name that was called |
LogicException | If 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().
|
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().
Symfony\Component\Process\Process::restart | ( | callable | $callback = null | ) |
Restarts the process.
Be warned that the process is cloned before being started.
callable | null | $callback | A PHP callback to run whenever there is some output available on STDOUT or STDERR |
RuntimeException | When process can't be launched |
RuntimeException | When process is already running |
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().
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.
callable | null | $callback | A PHP callback to run whenever there is some output available on STDOUT or STDERR |
RuntimeException | When process can't be launched |
RuntimeException | When process stopped after receiving signal |
LogicException | In 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().
Symfony\Component\Process\Process::setCommandLine | ( | $commandline | ) |
Sets the command line to be executed.
string | $commandline | The command to execute |
Definition at line 897 of file Process.php.
References Symfony\Component\Process\Process\$commandline.
Referenced by Symfony\Component\Process\PhpProcess\setPhpBinary().
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
bool | $enhance |
Definition at line 1193 of file Process.php.
Symfony\Component\Process\Process::setEnhanceWindowsCompatibility | ( | $enhance | ) |
Sets whether or not Windows compatibility is enabled.
bool | $enhance |
Definition at line 1165 of file Process.php.
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.
array | $env | The new environment variables |
Definition at line 1075 of file Process.php.
Referenced by Symfony\Component\Process\Process\__construct().
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.
int | float | null | $timeout | The timeout in seconds |
LogicException | if the output is disabled |
InvalidArgumentException | if the timeout is negative |
Definition at line 954 of file Process.php.
References Symfony\Component\Process\Process\$timeout, and Symfony\Component\Process\Process\validateTimeout().
Symfony\Component\Process\Process::setInput | ( | $input | ) |
Sets the input.
This content will be passed to the underlying process standard input.
resource | scalar | \Traversable | null | $input | The content |
LogicException | In 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().
Symfony\Component\Process\Process::setOptions | ( | array | $options | ) |
Sets the options for proc_open.
array | $options | The new options |
Definition at line 1139 of file Process.php.
References Symfony\Component\Process\Process\$options.
Symfony\Component\Process\Process::setPty | ( | $bool | ) |
Symfony\Component\Process\Process::setTimeout | ( | $timeout | ) |
Sets the process timeout (max.
runtime).
To disable the timeout, set this value to null.
int | float | null | $timeout | The timeout in seconds |
InvalidArgumentException | if 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().
Symfony\Component\Process\Process::setTty | ( | $tty | ) |
Enables or disables the TTY mode.
bool | $tty | True to enabled and false to disable |
RuntimeException | In case the TTY mode is not supported |
Definition at line 974 of file Process.php.
References Symfony\Component\Process\Process\$tty.
Symfony\Component\Process\Process::setWorkingDirectory | ( | $cwd | ) |
Sets the current working directory.
string | $cwd | The new working directory |
Definition at line 1045 of file Process.php.
References Symfony\Component\Process\Process\$cwd.
Symfony\Component\Process\Process::signal | ( | $signal | ) |
Sends a POSIX signal to the process.
int | $signal | A valid POSIX signal (see http://www.php.net/manual/en/pcntl.constants.php) |
LogicException | In case the process is not running |
RuntimeException | In case –enable-sigchild is activated and the process can't be killed |
RuntimeException | In case of failure |
Definition at line 407 of file Process.php.
References Symfony\Component\Process\Process\doSignal().
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.
callable | null | $callback | A PHP callback to run whenever there is some output available on STDOUT or STDERR |
RuntimeException | When process can't be launched |
RuntimeException | When process is already running |
LogicException | In 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().
Symfony\Component\Process\Process::stop | ( | $timeout = 10 , |
|
$signal = null |
|||
) |
Stops the process.
int | float | $timeout | The timeout in seconds |
int | $signal | A POSIX signal to send in case the process has not stop at timeout, default is SIGKILL (9) |
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().
|
protected |
Updates the status of the process, reads pipes.
bool | $blocking | Whether 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().
|
private |
Validates and returns the filtered timeout.
int | float | null | $timeout |
InvalidArgumentException | if 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().
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.
callable | null | $callback | A valid PHP callback |
RuntimeException | When process timed out |
RuntimeException | When process stopped after receiving signal |
LogicException | When 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().
|
private |
Definition at line 51 of file Process.php.
Referenced by Symfony\Component\Process\Process\buildCallback(), Symfony\Component\Process\Process\mustRun(), Symfony\Component\Process\Process\readPipes(), Symfony\Component\Process\Process\restart(), Symfony\Component\Process\Process\run(), Symfony\Component\Process\PhpProcess\start(), Symfony\Component\Process\Process\start(), and Symfony\Component\Process\Process\wait().
|
private |
Definition at line 53 of file Process.php.
Referenced by Symfony\Component\Process\Process\__construct(), Symfony\Component\Process\Process\getCommandLine(), Symfony\Component\Process\Process\setCommandLine(), and Symfony\Component\Process\Process\start().
|
private |
Definition at line 54 of file Process.php.
Referenced by Symfony\Component\Process\PhpProcess\__construct(), Symfony\Component\Process\Process\__construct(), Symfony\Component\Process\Process\getWorkingDirectory(), and Symfony\Component\Process\Process\setWorkingDirectory().
|
private |
Definition at line 69 of file Process.php.
Referenced by Symfony\Component\Process\Process\getEnhanceSigchildCompatibility().
|
private |
Definition at line 68 of file Process.php.
Referenced by Symfony\Component\Process\Process\getEnhanceWindowsCompatibility().
|
private |
Definition at line 55 of file Process.php.
Referenced by Symfony\Component\Process\PhpProcess\__construct(), Symfony\Component\Process\Process\__construct(), and Symfony\Component\Process\Process\getEnv().
|
private |
|
static |
Definition at line 92 of file Process.php.
|
private |
Definition at line 63 of file Process.php.
|
private |
Definition at line 52 of file Process.php.
|
private |
Definition at line 60 of file Process.php.
Referenced by Symfony\Component\Process\Process\getIdleTimeout().
|
private |
Definition at line 73 of file Process.php.
|
private |
Definition at line 72 of file Process.php.
|
private |
Definition at line 56 of file Process.php.
Referenced by Symfony\Component\Process\Process\__construct(), Symfony\Component\Process\Process\getInput(), and Symfony\Component\Process\Process\setInput().
|
private |
Definition at line 58 of file Process.php.
|
private |
Definition at line 81 of file Process.php.
Referenced by Symfony\Component\Process\Process\doSignal().
|
private |
Definition at line 61 of file Process.php.
Referenced by Symfony\Component\Process\PhpProcess\__construct(), Symfony\Component\Process\Process\__construct(), Symfony\Component\Process\Process\getOptions(), and Symfony\Component\Process\Process\setOptions().
|
private |
Definition at line 65 of file Process.php.
Referenced by Symfony\Component\Process\Process\isOutputDisabled().
|
private |
Definition at line 70 of file Process.php.
Referenced by Symfony\Component\Process\Process\restart().
|
private |
Definition at line 64 of file Process.php.
Referenced by Symfony\Component\Process\Process\updateStatus().
|
private |
Definition at line 79 of file Process.php.
|
private |
Definition at line 75 of file Process.php.
Referenced by Symfony\Component\Process\Process\isPty().
|
staticprivate |
Definition at line 83 of file Process.php.
|
private |
Definition at line 57 of file Process.php.
|
private |
Definition at line 71 of file Process.php.
Referenced by Symfony\Component\Process\Process\getStatus().
|
private |
Definition at line 67 of file Process.php.
|
private |
Definition at line 66 of file Process.php.
|
private |
Definition at line 59 of file Process.php.
Referenced by Symfony\Component\Process\PhpProcess\__construct(), Symfony\Component\Process\Process\__construct(), Symfony\Component\Process\Process\getTimeout(), Symfony\Component\Process\Process\setIdleTimeout(), Symfony\Component\Process\Process\setTimeout(), Symfony\Component\Process\Process\stop(), and Symfony\Component\Process\Process\validateTimeout().
|
private |
Definition at line 74 of file Process.php.
Referenced by Symfony\Component\Process\Process\isTty(), and Symfony\Component\Process\Process\setTty().
|
private |
Definition at line 77 of file Process.php.
const Symfony\Component\Process\Process::ERR = 'err' |
Definition at line 32 of file Process.php.
Referenced by Symfony\Component\Process\Pipes\WindowsPipes\__construct(), and cweagans\Composer\Patches\executeCommand().
const Symfony\Component\Process\Process::ITER_KEEP_OUTPUT = 2 |
Definition at line 47 of file Process.php.
const Symfony\Component\Process\Process::ITER_NON_BLOCKING = 1 |
Definition at line 46 of file Process.php.
const Symfony\Component\Process\Process::ITER_SKIP_ERR = 8 |
Definition at line 49 of file Process.php.
const Symfony\Component\Process\Process::ITER_SKIP_OUT = 4 |
Definition at line 48 of file Process.php.
const Symfony\Component\Process\Process::OUT = 'out' |
Definition at line 33 of file Process.php.
Referenced by Symfony\Component\Process\Pipes\WindowsPipes\__construct().
const Symfony\Component\Process\Process::STATUS_READY = 'ready' |
Definition at line 35 of file Process.php.
Referenced by Symfony\Component\Process\Tests\ProcessTest\testStatus().
const Symfony\Component\Process\Process::STATUS_STARTED = 'started' |
Definition at line 36 of file Process.php.
Referenced by Symfony\Component\Process\Tests\ProcessTest\testStatus().
const Symfony\Component\Process\Process::STATUS_TERMINATED = 'terminated' |
Definition at line 37 of file Process.php.
Referenced by Symfony\Component\Process\Tests\ProcessTest\testPTYCommand(), Symfony\Component\Process\Tests\ProcessTest\testStatus(), and Symfony\Component\Process\Tests\ProcessTest\testTTYCommand().
const Symfony\Component\Process\Process::STDERR = 2 |
Definition at line 41 of file Process.php.
Referenced by Symfony\Component\Process\Pipes\WindowsPipes\__construct().
const Symfony\Component\Process\Process::STDIN = 0 |
Definition at line 39 of file Process.php.
const Symfony\Component\Process\Process::STDOUT = 1 |
Definition at line 40 of file Process.php.
Referenced by Symfony\Component\Process\Pipes\WindowsPipes\__construct().
const Symfony\Component\Process\Process::TIMEOUT_PRECISION = 0.2 |
Definition at line 44 of file Process.php.
Referenced by Symfony\Component\Process\Pipes\UnixPipes\readAndWrite(), and Symfony\Component\Process\Pipes\WindowsPipes\readAndWrite().