class PendingProcess (View source)

Properties

protected Factory $factory

The process factory instance.

array<array-key,string>|string|null $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 $idleTimeout

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

array $environment

The additional environment variables for the process.

string|int|float|bool|resource|Traversable|null $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 $options

The options that will be passed to "proc_open".

protected array $fakeHandlers

The registered fake handler callbacks.

Methods

void
__construct(Factory $factory)

Create a new pending process instance.

$this
command(array|string $command)

Specify the command that will invoke the process.

$this
path(string $path)

Specify the working directory of the process.

$this
timeout(int $timeout)

Specify the maximum number of seconds the process may run.

$this
idleTimeout(int $timeout)

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

$this
forever()

Indicate that the process may run forever without timing out.

$this
env(array $environment)

Set the additional environent variables for the process.

$this
input(Traversable|resource|string|int|float|bool|null $input)

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

$this
quietly()

Disable output for the process.

$this
tty(bool $tty = true)

Enable TTY mode for the process.

$this
options(array $options)

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

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

Run the process.

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

Start the process in the background.

Process
toSymfonyProcess(array|string|null $command)

Get a Symfony Process instance from the current pending command.

$this
withFakeHandlers(array $fakeHandlers)

Specify the fake process result handlers for the pending process.

Closure|null
fakeFor(string $command)

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

mixed
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

void __construct(Factory $factory)

Create a new pending process instance.

Parameters

Factory $factory

Return Value

void

$this command(array|string $command)

Specify the command that will invoke the process.

Parameters

array|string $command

Return Value

$this

$this path(string $path)

Specify the working directory of the process.

Parameters

string $path

Return Value

$this

$this timeout(int $timeout)

Specify the maximum number of seconds the process may run.

Parameters

int $timeout

Return Value

$this

$this idleTimeout(int $timeout)

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

Parameters

int $timeout

Return Value

$this

$this forever()

Indicate that the process may run forever without timing out.

Return Value

$this

$this env(array $environment)

Set the additional environent variables for the process.

Parameters

array $environment

Return Value

$this

$this input(Traversable|resource|string|int|float|bool|null $input)

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

Parameters

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

Return Value

$this

$this quietly()

Disable output for the process.

Return Value

$this

$this tty(bool $tty = true)

Enable TTY mode for the process.

Parameters

bool $tty

Return Value

$this

$this options(array $options)

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

Parameters

array $options

Return Value

$this

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

Run the process.

Parameters

array|string $command
callable $output

Return Value

ProcessResult

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

Start the process in the background.

Parameters

array|string $command
callable $output

Return Value

InvokedProcess

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

$this withFakeHandlers(array $fakeHandlers)

Specify the fake process result handlers for the pending process.

Parameters

array $fakeHandlers

Return Value

$this

protected Closure|null fakeFor(string $command)

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

Parameters

string $command

Return Value

Closure|null

protected mixed resolveSynchronousFake(string $command, Closure $fake)

Resolve the given fake handler for a synchronous process.

Parameters

string $command
Closure $fake

Return Value

mixed

protected FakeInvokedProcess 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

FakeInvokedProcess