-
-
Notifications
You must be signed in to change notification settings - Fork 0
ProcessQueue
Executes queued processes sequentially while supporting detached entries and optional failure suppression.
Regular processes are executed in the order they were added and block the queue until completion. Detached processes are started in the order they were added but do not block subsequent entries.
A detached process that starts successfully is considered dispatched. Because
this implementation does not wait for detached processes to finish during run(),
their eventual runtime exit status cannot be incorporated into the final queue
result. However, a detached process that cannot be started at all is treated
as a startup failure and MAY affect the final status code unless its failure
is explicitly configured to be ignored.
To ensure detached processes finish gracefully without being killed when the
main PHP script ends, the queue automatically registers a shutdown handler
during instantiation that implicitly awaits all detached processes. They can
also be awaited explicitly via wait().
- Full name:
\FastForward\DevTools\Process\ProcessQueue - This class is marked as final and can't be subclassed
- This class implements:
\FastForward\DevTools\Process\ProcessQueueInterface - This class is a Final class
Initializes the queue and secures child processes from early termination.
public __construct(): mixedAdds a process to the queue.
public add(\Symfony\Component\Process\Process $process, bool $ignoreFailure = false, bool $detached = false): voidParameters:
| Parameter | Type | Description |
|---|---|---|
$process |
\Symfony\Component\Process\Process | the process instance that SHALL be added to the queue |
$ignoreFailure |
bool | indicates whether a failure of this process MUST NOT affect the final queue result |
$detached |
bool | indicates whether this process SHALL be started without blocking the next queued process |
Runs the queued processes and returns the resulting status code.
public run(\Symfony\Component\Console\Output\OutputInterface $output = new \Symfony\Component\Console\Output\NullOutput()): intThe returned status code represents the first non-zero exit code observed among non-ignored blocking processes, or among non-ignored detached processes that fail to start. Detached processes that start successfully are not awaited iteratively inside run() and therefore do not contribute their eventual runtime exit code to the returned result.
Parameters:
| Parameter | Type | Description |
|---|---|---|
$output |
\Symfony\Component\Console\Output\OutputInterface | the output used during execution |
Return Value:
the final exit status code produced by the queue execution
Waits for all detached processes to finish execution.
public wait(?\Symfony\Component\Console\Output\OutputInterface $output = new \Symfony\Component\Console\Output\NullOutput()): voidParameters:
| Parameter | Type | Description |
|---|---|---|
$output |
?\Symfony\Component\Console\Output\OutputInterface | the output interface to which process output and diagnostics MAY be written |