class InvokedProcess implements InvokedProcess (View source)

Properties

protected Process $process

The underlying process instance.

Methods

void
__construct(Process $process)

Create a new invoked process instance.

int|null
id()

Get the process ID if the process is still running.

$this
signal(int $signal)

Send a signal to the process.

int|null
stop(float $timeout = 10, int|null $signal = null)

Stop the process if it is still running.

bool
running()

Determine if the process is still running.

string
output()

Get the standard output for the process.

string
errorOutput()

Get the error output for the process.

string
latestOutput()

Get the latest standard output for the process.

string
latestErrorOutput()

Get the latest error output for the process.

wait(callable|null $output = null)

Wait for the process to finish.

waitUntil(callable|null $output = null)

Wait until the given callback returns true.

Details

void __construct(Process $process)

Create a new invoked process instance.

Parameters

Process $process

Return Value

void

int|null id()

Get the process ID if the process is still running.

Return Value

int|null

$this signal(int $signal)

Send a signal to the process.

Parameters

int $signal

Return Value

$this

int|null stop(float $timeout = 10, int|null $signal = null)

Stop the process if it is still running.

Parameters

float $timeout
int|null $signal

Return Value

int|null

bool running()

Determine if the process is still running.

Return Value

bool

string output()

Get the standard output for the process.

Return Value

string

string errorOutput()

Get the error output for the process.

Return Value

string

string latestOutput()

Get the latest standard output for the process.

Return Value

string

string latestErrorOutput()

Get the latest error output for the process.

Return Value

string

ProcessResult wait(callable|null $output = null)

Wait for the process to finish.

Parameters

callable|null $output

Return Value

ProcessResult

Exceptions

ProcessTimedOutException

ProcessResult waitUntil(callable|null $output = null)

Wait until the given callback returns true.

Parameters

callable|null $output

Return Value

ProcessResult

Exceptions

ProcessTimedOutException