Process
in package
uses
ForbidCloning, ForbidSerialization
Table of Contents
Properties
- $command : string
- $driverRunner : WeakMap
- $environment : array<string|int, mixed>
- $handle : ProcessHandle
- $options : array<string|int, mixed>
- $procHolder : WeakMap
- $runner : ProcessRunner
- $streamHolder : WeakMap
- $streams : ProcessStreams
- $workingDirectory : string
Methods
-
__debugInfo()
: array{command: string, workingDirectory: string, environment: array
, options: array , pid: int, status: string} - __serialize() : never
- __unserialize() : never
- getCommand() : string
- Returns the command to execute.
- getEnvironment() : array<string, string>
- Gets the environment variables array.
- getOptions() : array<string, bool>
- Gets the options to pass to {@see proc_open()}.
- getPid() : int
- Returns the PID of the child process.
- getStderr() : ReadableResourceStream
- Gets the process error stream (STDERR).
- getStdin() : WritableResourceStream
- Gets the process input stream (STDIN).
- getStdout() : ReadableResourceStream
- Gets the process output stream (STDOUT).
- getWorkingDirectory() : string
- Gets the current working directory.
- isRunning() : bool
- Determines if the process is still running.
- join() : int
- Wait for the process to end.
- kill() : void
- Forcibly end the process.
- signal() : void
- Send a signal to the process.
- start() : self
- Starts a new process.
- __clone() : mixed
- __construct() : mixed
- getRunner() : ProcessRunner
Properties
$command read-only
private
string
$command
$driverRunner
private
static WeakMap
$driverRunner
$environment read-only
private
array<string|int, mixed>
$environment
= []
$handle read-only
private
ProcessHandle
$handle
$options read-only
private
array<string|int, mixed>
$options
= []
$procHolder
private
static WeakMap
$procHolder
$runner read-only
private
ProcessRunner
$runner
$streamHolder
private
static WeakMap
$streamHolder
$streams read-only
private
ProcessStreams
$streams
$workingDirectory read-only
private
string
$workingDirectory
Methods
__debugInfo()
public
__debugInfo() : array{command: string, workingDirectory: string, environment: array, options: array, pid: int, status: string}
Return values
array{command: string, workingDirectory: string, environment: array__serialize()
public
final __serialize() : never
Return values
never__unserialize()
public
final __unserialize(array<string|int, mixed> $data) : never
Parameters
- $data : array<string|int, mixed>
Return values
nevergetCommand()
Returns the command to execute.
public
getCommand() : string
Return values
string —The command to execute.
getEnvironment()
Gets the environment variables array.
public
getEnvironment() : array<string, string>
Return values
array<string, string> —Array of environment variables.
getOptions()
Gets the options to pass to {@see proc_open()}.
public
getOptions() : array<string, bool>
Return values
array<string, bool> —Array of options.
getPid()
Returns the PID of the child process.
public
getPid() : int
Return values
intgetStderr()
Gets the process error stream (STDERR).
public
getStderr() : ReadableResourceStream
Return values
ReadableResourceStreamgetStdin()
Gets the process input stream (STDIN).
public
getStdin() : WritableResourceStream
Return values
WritableResourceStreamgetStdout()
Gets the process output stream (STDOUT).
public
getStdout() : ReadableResourceStream
Return values
ReadableResourceStreamgetWorkingDirectory()
Gets the current working directory.
public
getWorkingDirectory() : string
Return values
string —The working directory.
isRunning()
Determines if the process is still running.
public
isRunning() : bool
Return values
booljoin()
Wait for the process to end.
public
join([Cancellation|null $cancellation = null ]) : int
Parameters
- $cancellation : Cancellation|null = null
Return values
int —The process exit code.
kill()
Forcibly end the process.
public
kill() : void
signal()
Send a signal to the process.
public
signal(int $signo) : void
Parameters
- $signo : int
-
Signal number to send to process.
Tags
start()
Starts a new process.
public
static start(string|array<int, string> $command[, string|null $workingDirectory = null ][, array<string, string> $environment = [] ][, array<string, bool> $options = [] ][, Cancellation|null $cancellation = null ]) : self
Parameters
- $command : string|array<int, string>
-
Command to run.
- $workingDirectory : string|null = null
-
Working directory, or an empty string to use the working directory of the parent.
- $environment : array<string, string> = []
-
Environment variables, or use an empty array to inherit from the parent.
- $options : array<string, bool> = []
-
Options for proc_open().
- $cancellation : Cancellation|null = null
Tags
Return values
self__clone()
protected
final __clone() : mixed
__construct()
private
__construct(ProcessRunner $runner, ProcessHandle $handle, ProcessStreams $streams, string $command, string $workingDirectory[, array<string, string> $environment = [] ][, array<string|int, mixed> $options = [] ]) : mixed
Parameters
- $runner : ProcessRunner
- $handle : ProcessHandle
- $streams : ProcessStreams
- $command : string
- $workingDirectory : string
- $environment : array<string, string> = []
- $options : array<string|int, mixed> = []
getRunner()
private
static getRunner() : ProcessRunner