[ Index ]

PHP Cross Reference of phpBB-3.3.3-deutsch

title

Body

[close]

/vendor/symfony/process/ -> Process.php (summary)

(no description)

File Size: 1746 lines (56 kb)
Included or required:0 times
Referenced: 0 times
Includes or requires: 0 files

Defines 1 class

Process:: (75 methods):
  __construct()
  __destruct()
  __clone()
  run()
  mustRun()
  start()
  restart()
  wait()
  getPid()
  signal()
  disableOutput()
  enableOutput()
  isOutputDisabled()
  getOutput()
  getIncrementalOutput()
  getIterator()
  clearOutput()
  getErrorOutput()
  getIncrementalErrorOutput()
  clearErrorOutput()
  getExitCode()
  getExitCodeText()
  isSuccessful()
  hasBeenSignaled()
  getTermSignal()
  hasBeenStopped()
  getStopSignal()
  isRunning()
  isStarted()
  isTerminated()
  getStatus()
  stop()
  addOutput()
  addErrorOutput()
  getCommandLine()
  setCommandLine()
  getTimeout()
  getIdleTimeout()
  setTimeout()
  setIdleTimeout()
  setTty()
  isTty()
  setPty()
  isPty()
  getWorkingDirectory()
  setWorkingDirectory()
  getEnv()
  setEnv()
  getInput()
  setInput()
  getOptions()
  setOptions()
  getEnhanceWindowsCompatibility()
  setEnhanceWindowsCompatibility()
  getEnhanceSigchildCompatibility()
  setEnhanceSigchildCompatibility()
  inheritEnvironmentVariables()
  areEnvironmentVariablesInherited()
  checkTimeout()
  isPtySupported()
  getDescriptors()
  buildCallback()
  updateStatus()
  isSigchildEnabled()
  readPipesForOutput()
  validateTimeout()
  readPipes()
  close()
  resetProcessData()
  doSignal()
  prepareWindowsCommandLine()
  requireProcessIsStarted()
  requireProcessIsTerminated()
  escapeArgument()
  getDefaultEnv()


Class: Process  - X-Ref

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

__construct($commandline, $cwd = null, array $env = null, $input = null, $timeout = 60, array $options = null)   X-Ref

param: string|array   $commandline The command line to run
param: string|null    $cwd         The working directory or null to use the working dir of the current PHP process
param: array|null     $env         The environment variables or null to use the same environment as the current PHP process
param: mixed|null     $input       The input as stream resource, scalar or \Traversable, or null for no input
param: int|float|null $timeout     The timeout in seconds or null to disable
param: array          $options     An array of options for proc_open

__destruct()   X-Ref
No description

__clone()   X-Ref
No description

run($callback = null)   X-Ref
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.

return: int The exit status code
param: callable|null $callback A PHP callback to run whenever there is some

mustRun(callable $callback = null)   X-Ref
Runs the process.

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

return: $this

start(callable $callback = null)   X-Ref
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.

param: callable|null $callback A PHP callback to run whenever there is some

restart(callable $callback = null)   X-Ref
Restarts the process.

Be warned that the process is cloned before being started.

return: static
param: callable|null $callback A PHP callback to run whenever there is some

wait(callable $callback = null)   X-Ref
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.

return: int The exitcode of the process
param: callable|null $callback A valid PHP callback

getPid()   X-Ref
Returns the Pid (process identifier), if applicable.

return: int|null The process id if running, null otherwise

signal($signal)   X-Ref
Sends a POSIX signal to the process.

return: $this
param: int $signal A valid POSIX signal (see https://php.net/pcntl.constants)

disableOutput()   X-Ref
Disables fetching output and error output from the underlying process.

return: $this

enableOutput()   X-Ref
Enables fetching output and error output from the underlying process.

return: $this

isOutputDisabled()   X-Ref
Returns true in case the output is disabled, false otherwise.

return: bool

getOutput()   X-Ref
Returns the current output of the process (STDOUT).

return: string The process output

getIncrementalOutput()   X-Ref
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.

return: string The process output since the last call

getIterator($flags = 0)   X-Ref
Returns an iterator to the output of the process, with the output type as keys (Process::OUT/ERR).

return: \Generator
param: int $flags A bit field of Process::ITER_* flags

clearOutput()   X-Ref
Clears the process output.

return: $this

getErrorOutput()   X-Ref
Returns the current error output of the process (STDERR).

return: string The process error output

getIncrementalErrorOutput()   X-Ref
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.

return: string The process error output since the last call

clearErrorOutput()   X-Ref
Clears the process output.

return: $this

getExitCode()   X-Ref
Returns the exit code returned by the process.

return: int|null The exit status code, null if the Process is not terminated

getExitCodeText()   X-Ref
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.

return: string|null A string representation for the exit status code, null if the Process is not terminated

isSuccessful()   X-Ref
Checks if the process ended successfully.

return: bool true if the process ended successfully, false otherwise

hasBeenSignaled()   X-Ref
Returns true if the child process has been terminated by an uncaught signal.

It always returns false on Windows.

return: bool

getTermSignal()   X-Ref
Returns the number of the signal that caused the child process to terminate its execution.

It is only meaningful if hasBeenSignaled() returns true.

return: int

hasBeenStopped()   X-Ref
Returns true if the child process has been stopped by a signal.

It always returns false on Windows.

return: bool

getStopSignal()   X-Ref
Returns the number of the signal that caused the child process to stop its execution.

It is only meaningful if hasBeenStopped() returns true.

return: int

isRunning()   X-Ref
Checks if the process is currently running.

return: bool true if the process is currently running, false otherwise

isStarted()   X-Ref
Checks if the process has been started with no regard to the current state.

return: bool true if status is ready, false otherwise

isTerminated()   X-Ref
Checks if the process is terminated.

return: bool true if process is terminated, false otherwise

getStatus()   X-Ref
Gets the process status.

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

return: string The current process status

stop($timeout = 10, $signal = null)   X-Ref
Stops the process.

return: int|null The exit-code of the process or null if it's not running
param: int|float $timeout The timeout in seconds
param: int       $signal  A POSIX signal to send in case the process has not stop at timeout, default is SIGKILL (9)

addOutput($line)   X-Ref
Adds a line to the STDOUT stream.

param: string $line The line to append

addErrorOutput($line)   X-Ref
Adds a line to the STDERR stream.

param: string $line The line to append

getCommandLine()   X-Ref
Gets the command line to be executed.

return: string The command to execute

setCommandLine($commandline)   X-Ref
Sets the command line to be executed.

return: $this
param: string|array $commandline The command to execute

getTimeout()   X-Ref
Gets the process timeout (max. runtime).

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

getIdleTimeout()   X-Ref
Gets the process idle timeout (max. time since last output).

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

setTimeout($timeout)   X-Ref
Sets the process timeout (max. runtime) in seconds.

To disable the timeout, set this value to null.

return: $this
param: int|float|null $timeout The timeout in seconds

setIdleTimeout($timeout)   X-Ref
Sets the process idle timeout (max. time since last output).

To disable the timeout, set this value to null.

return: $this
param: int|float|null $timeout The timeout in seconds

setTty($tty)   X-Ref
Enables or disables the TTY mode.

return: $this
param: bool $tty True to enabled and false to disable

isTty()   X-Ref
Checks if the TTY mode is enabled.

return: bool true if the TTY mode is enabled, false otherwise

setPty($bool)   X-Ref
Sets PTY mode.

return: $this
param: bool $bool

isPty()   X-Ref
Returns PTY state.

return: bool

getWorkingDirectory()   X-Ref
Gets the working directory.

return: string|null The current working directory or null on failure

setWorkingDirectory($cwd)   X-Ref
Sets the current working directory.

return: $this
param: string $cwd The new working directory

getEnv()   X-Ref
Gets the environment variables.

return: array The current environment variables

setEnv(array $env)   X-Ref
Sets the environment variables.

Each environment variable value should be a string.
If it is an array, the variable is ignored.
If it is false or null, it will be removed when
env vars are otherwise inherited.

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

return: $this
param: array $env The new environment variables

getInput()   X-Ref
Gets the Process input.

return: resource|string|\Iterator|null The Process input

setInput($input)   X-Ref
Sets the input.

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

return: $this
param: string|int|float|bool|resource|\Traversable|null $input The content

getOptions()   X-Ref
Gets the options for proc_open.

return: array The current options

setOptions(array $options)   X-Ref
Sets the options for proc_open.

return: $this
param: array $options The new options

getEnhanceWindowsCompatibility()   X-Ref
Gets whether or not Windows compatibility is enabled.

This is true by default.

return: bool

setEnhanceWindowsCompatibility($enhance)   X-Ref
Sets whether or not Windows compatibility is enabled.

return: $this
param: bool $enhance

getEnhanceSigchildCompatibility()   X-Ref
Returns whether sigchild compatibility mode is activated or not.

return: bool

setEnhanceSigchildCompatibility($enhance)   X-Ref
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

return: $this
param: bool $enhance

inheritEnvironmentVariables($inheritEnv = true)   X-Ref
Sets whether environment variables will be inherited or not.

return: $this
param: bool $inheritEnv

areEnvironmentVariablesInherited()   X-Ref
Returns whether environment variables will be inherited or not.

return: bool

checkTimeout()   X-Ref
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


isPtySupported()   X-Ref
Returns whether PTY is supported on the current operating system.

return: bool

getDescriptors()   X-Ref
Creates the descriptors needed by the proc_open.

return: array

buildCallback(callable $callback = null)   X-Ref
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.

return: \Closure A PHP closure
param: callable|null $callback The user defined PHP callback

updateStatus($blocking)   X-Ref
Updates the status of the process, reads pipes.

param: bool $blocking Whether to use a blocking read call

isSigchildEnabled()   X-Ref
Returns whether PHP has been compiled with the '--enable-sigchild' option or not.

return: bool

readPipesForOutput($caller, $blocking = false)   X-Ref
Reads pipes for the freshest output.

param: string $caller   The name of the method that needs fresh outputs
param: bool   $blocking Whether to use blocking calls or not

validateTimeout($timeout)   X-Ref
Validates and returns the filtered timeout.

return: float|null
param: int|float|null $timeout

readPipes($blocking, $close)   X-Ref
Reads pipes, executes callback.

param: bool $blocking Whether to use blocking calls or not
param: bool $close    Whether to close file handles or not

close()   X-Ref
Closes process resource, closes file handles, sets the exitcode.

return: int The exitcode

resetProcessData()   X-Ref
Resets data related to the latest run of the process.


doSignal($signal, $throwException)   X-Ref
Sends a POSIX signal to the process.

return: bool True if the signal was sent successfully, false otherwise
param: int  $signal         A valid POSIX signal (see https://php.net/pcntl.constants)
param: bool $throwException Whether to throw exception in case signal failed

prepareWindowsCommandLine($cmd, array &$env)   X-Ref
No description

requireProcessIsStarted($functionName)   X-Ref
No description

requireProcessIsTerminated($functionName)   X-Ref
Ensures the process is terminated, throws a LogicException if the process has a status different than `terminated`.

param: string $functionName The function name that was called

escapeArgument($argument)   X-Ref
Escapes a string to be used as a shell argument.

return: string The escaped argument
param: string $argument The argument that will be escaped

getDefaultEnv()   X-Ref
No description



Generated: Sun Feb 14 20:08:31 2021 Cross-referenced by PHPXref 0.7.1