class PendingProcess

Traits

Properties

protected Factory $factory

The process factory instance.

null|array<array-key, string>|string $command

The command to invoke the process.

string|null $path

The working directory of the process.

int|null $timeout

The maximum number of seconds the process may run.

int|null $idleTimeout

The maximum number of seconds the process may go without returning output.

array<string, false|string|Stringable> $environment

The additional environment variables for the process.

null|bool|float|int|resource|string|Traversable $input

The standard input data that should be piped into the command.

bool $quietly

Indicates whether output should be disabled for the process.

bool $tty

Indicates if TTY mode should be enabled.

array<string, mixed> $options

The options that will be passed to "proc_open".

protected array<string, callable> $fakeHandlers

The registered fake handler callbacks.

Methods

mixed
when(mixed $value = null, callable|null $callback = null, callable|null $default = null)

Apply the callback if the given "value" is (or resolves to) truthy.

mixed
unless(mixed $value = null, callable|null $callback = null, callable|null $default = null)

Apply the callback if the given "value" is (or resolves to) falsy.

Closure|null
guardProcessOutput(Process $process, callable|null $output)

Stop the process if its output callback fails.

__construct(Factory $factory)

Create a new pending process instance.

command(array|string $command)

Specify the command that will invoke the process.

path(string $path)

Specify the working directory of the process.

timeout(CarbonInterval|int $timeout)

Specify the maximum number of seconds the process may run.

idleTimeout(CarbonInterval|int $timeout)

Specify the maximum number of seconds a process may go without returning output.

forever()

Indicate that the process may run forever without timing out.

env(array $environment)

Set the additional environment variables for the process.

input(mixed $input)

Set the standard input that should be provided when invoking the process.

quietly()

Disable output for the process.

tty(bool $tty = true)

Enable TTY mode for the process.

options(array $options)

Set the "proc_open" options that should be used when invoking the process.

run(array|string|null $command = null, callable|null $output = null)

Run the process.

start(array|string|null $command = null, callable|null $output = null)

Start the process in the background.

Process
toSymfonyProcess(array|string|null $command)

Get a Symfony Process instance from the current pending command.

bool
supportsTty()

Determine whether TTY is supported on the current operating system.

withFakeHandlers(array $fakeHandlers)

Specify the fake process result handlers for the pending process.

callable|null
fakeFor(string $command)

Get the fake handler for the given command, if applicable.

resolveSynchronousFake(string $command, Closure $fake)

Resolve the given fake handler for a synchronous process.

resolveAsynchronousFake(string $command, callable|null $output, Closure $fake)

Resolve the given fake handler for an asynchronous process.

Details

in Conditionable at line 23
mixed when(mixed $value = null, callable|null $callback = null, callable|null $default = null)

Apply the callback if the given "value" is (or resolves to) truthy.

Parameters

mixed $value
callable|null $callback
callable|null $default

Return Value

mixed

in Conditionable at line 56
mixed unless(mixed $value = null, callable|null $callback = null, callable|null $default = null)

Apply the callback if the given "value" is (or resolves to) falsy.

Parameters

mixed $value
callable|null $callback
callable|null $default

Return Value

mixed

protected Closure|null guardProcessOutput(Process $process, callable|null $output)

Stop the process if its output callback fails.

Parameters

Process $process
callable|null $output

Return Value

Closure|null

at line 97
__construct(Factory $factory)

Create a new pending process instance.

Parameters

Factory $factory

at line 105
PendingProcess command(array|string $command)

Specify the command that will invoke the process.

Parameters

array|string $command

Return Value

PendingProcess

at line 115
PendingProcess path(string $path)

Specify the working directory of the process.

Parameters

string $path

Return Value

PendingProcess

at line 125
PendingProcess timeout(CarbonInterval|int $timeout)

Specify the maximum number of seconds the process may run.

Parameters

CarbonInterval|int $timeout

Return Value

PendingProcess

at line 135
PendingProcess idleTimeout(CarbonInterval|int $timeout)

Specify the maximum number of seconds a process may go without returning output.

Parameters

CarbonInterval|int $timeout

Return Value

PendingProcess

at line 145
PendingProcess forever()

Indicate that the process may run forever without timing out.

Return Value

PendingProcess

at line 157
PendingProcess env(array $environment)

Set the additional environment variables for the process.

Parameters

array $environment

Return Value

PendingProcess

at line 169
PendingProcess input(mixed $input)

Set the standard input that should be provided when invoking the process.

Parameters

mixed $input

Return Value

PendingProcess

at line 179
PendingProcess quietly()

Disable output for the process.

Return Value

PendingProcess

at line 189
PendingProcess tty(bool $tty = true)

Enable TTY mode for the process.

Parameters

bool $tty

Return Value

PendingProcess

at line 201
PendingProcess options(array $options)

Set the "proc_open" options that should be used when invoking the process.

Parameters

array $options

Return Value

PendingProcess

at line 214
ProcessResult run(array|string|null $command = null, callable|null $output = null)

Run the process.

Parameters

array|string|null $command
callable|null $output

Return Value

ProcessResult

Exceptions

ProcessTimedOutException
RuntimeException

at line 241
InvokedProcess start(array|string|null $command = null, callable|null $output = null)

Start the process in the background.

The caller must wait for or stop the process before its owning coroutine exits.

Parameters

array|string|null $command
callable|null $output

Return Value

InvokedProcess

Exceptions

RuntimeException

at line 262
protected Process toSymfonyProcess(array|string|null $command)

Get a Symfony Process instance from the current pending command.

Parameters

array|string|null $command

Return Value

Process

at line 299
bool supportsTty()

Determine whether TTY is supported on the current operating system.

Return Value

bool

at line 309
PendingProcess withFakeHandlers(array $fakeHandlers)

Specify the fake process result handlers for the pending process.

Parameters

array $fakeHandlers

Return Value

PendingProcess

at line 319
protected callable|null fakeFor(string $command)

Get the fake handler for the given command, if applicable.

Parameters

string $command

Return Value

callable|null

at line 330
protected ProcessResult resolveSynchronousFake(string $command, Closure $fake)

Resolve the given fake handler for a synchronous process.

Parameters

string $command
Closure $fake

Return Value

ProcessResult

Exceptions

LogicException

at line 357
protected InvokedProcess resolveAsynchronousFake(string $command, callable|null $output, Closure $fake)

Resolve the given fake handler for an asynchronous process.

Parameters

string $command
callable|null $output
Closure $fake

Return Value

InvokedProcess

Exceptions

LogicException