PendingProcess
class PendingProcess (View source)
Traits
Properties
| static protected array | $macros | The registered string macros. |
from Macroable |
| 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|float|null | $timeout | The maximum number of seconds the process may run. |
|
| int|float|null | $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
Apply the callback if the given "value" is (or resolves to) truthy.
Apply the callback if the given "value" is (or resolves to) falsy.
Mix another object into the class.
Dynamically handle calls to the class.
Dynamically handle calls to the class.
Specify the command that will invoke the process.
Specify the working directory of the process.
Specify the maximum number of seconds the process may run.
Specify the maximum number of seconds a process may go without returning output.
Indicate that the process may run forever without timing out.
Set the additional environment variables for the process.
Set the standard input that should be provided when invoking the process.
Disable output for the process.
Enable TTY mode for the process.
Set the "proc_open" options that should be used when invoking the process.
Run the process.
Start the process in the background.
Get a Symfony Process instance from the current pending command.
Determine whether TTY is supported on the current operating system.
Specify the fake process result handlers for the pending process.
Resolve the given fake handler for a synchronous process.
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.
$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.
static void
macro(string $name, object|callable $macro)
Register a custom macro.
static void
mixin(object $mixin, bool $replace = true)
Mix another object into the class.
static bool
hasMacro(string $name)
Checks if macro is registered.
static void
flushMacros()
Flush the existing macros.
static mixed
__callStatic(string $method, array $parameters)
Dynamically handle calls to the class.
mixed
__call(string $method, array $parameters)
Dynamically handle calls to the class.
__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.
ProcessResult
run(array|string|null $command = null, callable|null $output = null)
Run the process.
InvokedProcess|FakeInvokedProcess
start(array|string|null $command = null, callable|null $output = null)
Start the process in the background.
protected 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.
protected Closure|null
fakeFor(string $command)
Get the fake handler for the given command, if applicable.
protected mixed
resolveSynchronousFake(string $command, Closure $fake)
Resolve the given fake handler for a synchronous process.
protected FakeInvokedProcess
resolveAsynchronousFake(string $command, callable|null $output, Closure $fake)
Resolve the given fake handler for an asynchronous process.