Property | Type | Description | |
---|---|---|---|
$exitCodes | array | User-defined errors must use exit codes in the 64-113 range. |
Method | Description | |
---|---|---|
__clone ( ) | ||
__construct ( string $commandline, string | null $cwd = null, array $env = null, mixed | null $input = null, integer | float | null $timeout = 60, array $options = [] ) | Constructor. | |
__destruct ( ) | ||
addErrorOutput ( string $line ) | Adds a line to the STDERR stream. | |
addOutput ( string $line ) | Adds a line to the STDOUT stream. | |
areEnvironmentVariablesInherited ( ) : boolean | Returns whether environment variables will be inherited or not. | |
checkTimeout ( ) | Performs a check between the timeout definition and the time the process started. | |
clearErrorOutput ( ) : |
Clears the process output. | |
clearOutput ( ) : |
Clears the process output. | |
disableOutput ( ) : |
Disables fetching output and error output from the underlying process. | |
enableOutput ( ) : |
Enables fetching output and error output from the underlying process. | |
getCommandLine ( ) : string | Gets the command line to be executed. | |
getEnhanceSigchildCompatibility ( ) : boolean | Returns whether sigchild compatibility mode is activated or not. | |
getEnhanceWindowsCompatibility ( ) : boolean | Gets whether or not Windows compatibility is enabled. | |
getEnv ( ) : array | Gets the environment variables. | |
getErrorOutput ( ) : string | Returns the current error output of the process (STDERR). | |
getExitCode ( ) : null | integer | Returns the exit code returned by the process. | |
getExitCodeText ( ) : null | string | Returns a string representation for the exit code returned by the process. | |
getIdleTimeout ( ) : float | null | Gets the process idle timeout (max. time since last output). | |
getIncrementalErrorOutput ( ) : string | Returns the errorOutput incrementally. | |
getIncrementalOutput ( ) : string | Returns the output incrementally. | |
getInput ( ) : resource | string | Iterator | null | Gets the Process input. | |
getIterator ( integer $flags ) : Generator | Returns an iterator to the output of the process, with the output type as keys (Process::OUT/ERR). | |
getOptions ( ) : array | Gets the options for proc_open. | |
getOutput ( ) : string | Returns the current output of the process (STDOUT). | |
getPid ( ) : integer | null | Returns the Pid (process identifier), if applicable. | |
getStatus ( ) : string | Gets the process status. | |
getStopSignal ( ) : integer | Returns the number of the signal that caused the child process to stop its execution. | |
getTermSignal ( ) : integer | Returns the number of the signal that caused the child process to terminate its execution. | |
getTimeout ( ) : float | null | Gets the process timeout (max. runtime). | |
getWorkingDirectory ( ) : string | null | Gets the working directory. | |
hasBeenSignaled ( ) : boolean | Returns true if the child process has been terminated by an uncaught signal. | |
hasBeenStopped ( ) : boolean | Returns true if the child process has been stopped by a signal. | |
inheritEnvironmentVariables ( boolean $inheritEnv = true ) : self | Sets whether environment variables will be inherited or not. | |
isOutputDisabled ( ) : boolean | Returns true in case the output is disabled, false otherwise. | |
isPty ( ) : boolean | Returns PTY state. | |
isPtySupported ( ) : boolean | Returns whether PTY is supported on the current operating system. | |
isRunning ( ) : boolean | Checks if the process is currently running. | |
isStarted ( ) : boolean | Checks if the process has been started with no regard to the current state. | |
isSuccessful ( ) : boolean | Checks if the process ended successfully. | |
isTerminated ( ) : boolean | Checks if the process is terminated. | |
isTty ( ) : boolean | Checks if the TTY mode is enabled. | |
mustRun ( callable $callback = null ) : self | Runs the process. | |
restart ( callable $callback = null ) : |
Restarts the process. | |
run ( callable | null $callback = null ) : integer | Runs the process. | |
setCommandLine ( string $commandline ) : self | Sets the command line to be executed. | |
setEnhanceSigchildCompatibility ( boolean $enhance ) : self | Activates sigchild compatibility mode. | |
setEnhanceWindowsCompatibility ( boolean $enhance ) : self | Sets whether or not Windows compatibility is enabled. | |
setEnv ( array $env ) : self | Sets the environment variables. | |
setIdleTimeout ( integer | float | null $timeout ) : self | Sets the process idle timeout (max. time since last output). | |
setInput ( resource | scalar | Traversable | null $input ) : self | Sets the input. | |
setOptions ( array $options ) : self | Sets the options for proc_open. | |
setPty ( boolean $bool ) : self | Sets PTY mode. | |
setTimeout ( integer | float | null $timeout ) : self | Sets the process timeout (max. runtime). | |
setTty ( boolean $tty ) : self | Enables or disables the TTY mode. | |
setWorkingDirectory ( string $cwd ) : self | Sets the current working directory. | |
signal ( integer $signal ) : |
Sends a POSIX signal to the process. | |
start ( callable $callback = null ) | Starts the process and returns after writing the input to STDIN. | |
stop ( integer | float $timeout = 10, integer $signal = null ) : integer | Stops the process. | |
wait ( callable $callback = null ) : integer | Waits for the process to terminate. |
Method | Description | |
---|---|---|
buildCallback ( callable $callback = null ) : Closure | Builds up the callback used by wait(). | |
isSigchildEnabled ( ) : boolean | Returns whether PHP has been compiled with the '--enable-sigchild' option or not. | |
updateStatus ( boolean $blocking ) | Updates the status of the process, reads pipes. |
Method | Description | |
---|---|---|
close ( ) : integer | Closes process resource, closes file handles, sets the exitcode. | |
doSignal ( integer $signal, boolean $throwException ) : boolean | Sends a POSIX signal to the process. | |
getDescriptors ( ) : array | Creates the descriptors needed by the proc_open. | |
readPipes ( boolean $blocking, boolean $close ) | Reads pipes, executes callback. | |
readPipesForOutput ( string $caller, boolean $blocking = false ) | Reads pipes for the freshest output. | |
requireProcessIsStarted ( string $functionName ) | Ensures the process is running or terminated, throws a LogicException if the process has a not started. | |
requireProcessIsTerminated ( string $functionName ) | Ensures the process is terminated, throws a LogicException if the process has a status different than terminated. | |
resetProcessData ( ) | Resets data related to the latest run of the process. | |
validateTimeout ( integer | float | null $timeout ) : float | null | Validates and returns the filtered timeout. |
public __construct ( string $commandline, string | null $cwd = null, array $env = null, mixed | null $input = null, integer | float | null $timeout = 60, array $options = [] ) | ||
$commandline | string | The command line to run |
$cwd | string | null | The working directory or null to use the working dir of the current PHP process |
$env | array | The environment variables or null to use the same environment as the current PHP process |
$input | mixed | null | The input as stream resource, scalar or \Traversable, or null for no input |
$timeout | integer | float | null | The timeout in seconds or null to disable |
$options | array | An array of options for proc_open |
public addErrorOutput ( string $line ) | ||
$line | string | The line to append |
public areEnvironmentVariablesInherited ( ) : boolean | ||
return | boolean |
protected buildCallback ( callable $callback = null ) : Closure | ||
$callback | callable | The user defined PHP callback |
return | Closure | A PHP closure |
public checkTimeout ( ) |
public clearErrorOutput ( ) : |
||
return |
public clearOutput ( ) : |
||
return |
public disableOutput ( ) : |
||
return |
public enableOutput ( ) : |
||
return |
public getCommandLine ( ) : string | ||
return | string | The command to execute |
public getEnhanceSigchildCompatibility ( ) : boolean | ||
return | boolean |
public getEnhanceWindowsCompatibility ( ) : boolean | ||
return | boolean |
public getErrorOutput ( ) : string | ||
return | string | The process error output |
public getExitCode ( ) : null | integer | ||
return | null | integer | The exit status code, null if the Process is not terminated |
public getExitCodeText ( ) : null | string | ||
return | null | string | A string representation for the exit status code, null if the Process is not terminated |
public getIdleTimeout ( ) : float | null | ||
return | float | null | The timeout in seconds or null if it's disabled |
public getIncrementalErrorOutput ( ) : string | ||
return | string | The process error output since the last call |
public getIncrementalOutput ( ) : string | ||
return | string | The process output since the last call |
public getIterator ( integer $flags ) : Generator | ||
$flags | integer | A bit field of Process::ITER_* flags |
return | Generator |
public getOptions ( ) : array | ||
return | array | The current options |
public getStopSignal ( ) : integer | ||
return | integer |
public getTermSignal ( ) : integer | ||
return | integer |
public getTimeout ( ) : float | null | ||
return | float | null | The timeout in seconds or null if it's disabled |
public getWorkingDirectory ( ) : string | null | ||
return | string | null | The current working directory or null on failure |
public hasBeenSignaled ( ) : boolean | ||
return | boolean |
public hasBeenStopped ( ) : boolean | ||
return | boolean |
public inheritEnvironmentVariables ( boolean $inheritEnv = true ) : self | ||
$inheritEnv | boolean | |
return | self | The current Process instance |
public isOutputDisabled ( ) : boolean | ||
return | boolean |
public static isPtySupported ( ) : boolean | ||
return | boolean |
protected isSigchildEnabled ( ) : boolean | ||
return | boolean |
public isSuccessful ( ) : boolean | ||
return | boolean | true if the process ended successfully, false otherwise |
public isTerminated ( ) : boolean | ||
return | boolean | true if process is terminated, false otherwise |
public setCommandLine ( string $commandline ) : self | ||
$commandline | string | The command to execute |
return | self | The current Process instance |
public setEnhanceSigchildCompatibility ( boolean $enhance ) : self | ||
$enhance | boolean | |
return | self | The current Process instance |
public setEnhanceWindowsCompatibility ( boolean $enhance ) : self | ||
$enhance | boolean | |
return | self | The current Process instance |
public setInput ( resource | scalar | Traversable | null $input ) : self | ||
$input | resource | scalar | Traversable | null | The content |
return | self | The current Process instance |
public setOptions ( array $options ) : self | ||
$options | array | The new options |
return | self | The current Process instance |
public setWorkingDirectory ( string $cwd ) : self | ||
$cwd | string | The new working directory |
return | self | The current Process instance |
protected updateStatus ( boolean $blocking ) | ||
$blocking | boolean | Whether to use a blocking read call |
public static array $exitCodes | ||
return | array |