class PendingProcess (View source)

Traits

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

$this|TWhenReturnType
when(TWhenParameter|TWhenParameter|null $value = null, callable|null $callback = null, callable|null $default = null)

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

$this|TUnlessReturnType
unless(TUnlessParameter|TUnlessParameter|null $value = null, callable|null $callback = null, callable|null $default = null)

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

__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(CarbonInterval|int $timeout)

Specify the maximum number of seconds the process may run.

$this
idleTimeout(CarbonInterval|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 environment 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|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.

$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

$this|TWhenReturnType when(TWhenParameter|TWhenParameter|null $value = null, callable|null $callback = null, callable|null $default = null)

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

Parameters

TWhenParameter|TWhenParameter|null $value
callable|null $callback
callable|null $default

Return Value

$this|TWhenReturnType

$this|TUnlessReturnType unless(TUnlessParameter|TUnlessParameter|null $value = null, callable|null $callback = null, callable|null $default = null)

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

Parameters

TUnlessParameter|TUnlessParameter|null $value
callable|null $callback
callable|null $default

Return Value

$this|TUnlessReturnType

__construct(Factory $factory)

Create a new pending process instance.

Parameters

Factory $factory

$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(CarbonInterval|int $timeout)

Specify the maximum number of seconds the process may run.

Parameters

CarbonInterval|int $timeout

Return Value

$this

$this idleTimeout(CarbonInterval|int $timeout)

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

Parameters

CarbonInterval|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 environment 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|null $command = null, callable|null $output = null)

Run the process.

Parameters

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

Return Value

ProcessResult

Exceptions

ProcessTimedOutException
RuntimeException

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

Start the process in the background.

Parameters

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

Return Value

InvokedProcess

Exceptions

RuntimeException

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

bool supportsTty()

Determine whether TTY is supported on the current operating system.

Return Value

bool

$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

Exceptions

LogicException
Throwable

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

Exceptions

LogicException

Laravel Cloud is the best place to deploy Laravel, Nuxt, Express, Hono, Node.js, Bun, Go, Flask, Python, and more, with dedicated infrastructure available on AWS through Laravel Private Cloud.