Executes queued processes sequentially while supporting detached entries and optional failure suppression.
Description
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.
Buffered detached output is flushed only after the blocking portion of the queue has finished, which keeps later process output from interleaving with currently running blocking commands.
Interfaces
Properties
Stores queued process entries in insertion order.
Stores detached processes that have already been started and whose output SHALL be emitted only after blocking processes finish.
Methods
Adds a process to the queue.
Runs the queued processes and returns the resulting status code.
Waits for detached processes to finish and flushes completed buffered output.
Creates a callback that buffers detached process output until flushing.
Creates a callback that forwards process output to the configured output.
Flushes completed detached process output in enqueue order.
Formats the configured process command line without shell escaping noise.
Reads the raw configured Process command line.
Resolves the label used when presenting queued process output.
Runs a process synchronously and returns its exit code.
Runs a blocking process inside a grouped GitHub Actions log section.
Starts a process in detached mode without waiting for completion.
Writes buffered detached output to the configured output.
private
static
ReflectionProperty|null
$commandLineProperty
=
null
Stores queued process entries in insertion order.
private
array<int, Process, ignoreFailure: bool, detached: bool, label: string}>
$entries
=
[]
private
GithubActionOutput
$githubActionOutput
Stores detached processes that have already been started and whose output SHALL be emitted only after blocking processes finish.
private
array<int, Process, label: string, standardOutput: string, errorOutput: string}>
$runningDetachedProcesses
=
[]
public
__construct(GithubActionOutput
$githubActionOutput) : mixed
Parameters
Description
wraps grouped queue output in GitHub Actions logs when supported
Adds a process to the queue.
public
add(Process
$process[,
bool
$ignoreFailure = false][,
bool
$detached = false][,
string|null
$label = null]) : void
Parameters
$process
:
Process
Description
the process instance that SHALL be added to the queue
$ignoreFailure
:
bool
=
false
Description
indicates whether a failure of this process MUST NOT affect the final queue result
$detached
:
bool
=
false
Description
indicates whether this process SHALL be started without blocking the next queued process
$label
:
string|null
=
null
Description
an optional label that MAY be used to present the process output as a grouped block
Runs the queued processes and returns the resulting status code.
public
run([OutputInterface
$output = new NullOutput()]) : int
Description
The 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
$output
:
OutputInterface
=
new NullOutput()
Description
the output used during execution
Return values
Description
the final exit status code produced by the queue execution
Waits for detached processes to finish and flushes completed buffered output.
public
wait([OutputInterface|null
$output = null]) : void
Parameters
$output
:
OutputInterface|null
=
null
Description
the output interface to which process output and diagnostics MAY be written
Creates a callback that buffers detached process output until flushing.
private
createBufferedOutputCallback(Process, label: string, standardOutput: string, errorOutput: string}
$entry) : callable(string, string): void
Parameters
$entry
:
Process, label: string, standardOutput: string, errorOutput: string}
Return values
Creates a callback that forwards process output to the configured output.
private
createOutputCallback(OutputInterface
$output) : callable(string, string): void
Description
The callback SHALL stream both standard output and error output exactly as received, preserving ANSI escape sequences when the underlying command emits them.
Parameters
$output
:
OutputInterface
Description
the output destination
Return values
Flushes completed detached process output in enqueue order.
private
flushDetachedProcessesOutput(OutputInterface
$output) : bool
Parameters
$output
:
OutputInterface
Description
the output that SHALL receive detached process output
Return values
Description
whether at least one detached process output has been flushed
Formats the configured process command line without shell escaping noise.
private
formatProcessCommandLine(Process
$process) : string
Parameters
$process
:
Process
Description
the queued process instance
Return values
Description
the human-readable command line
Reads the raw configured Process command line.
private
getProcessCommandLine(Process
$process) : array<int, string>|string
Description
Symfony keeps the configured command line in a private property, so the
queue reads it reflectively to build a cleaner default label than the
shell-escaped output returned by Process::getCommandLine().
Parameters
$process
:
Process
Description
the queued process instance
Return values
Resolves the label used when presenting queued process output.
private
resolveLabel(Process
$process[,
string|null
$label = null]) : string
Parameters
$process
:
Process
Description
the queued process instance
$label
:
string|null
=
null
Description
the optional label provided by the caller
Return values
Description
the resolved presentation label
Runs a process synchronously and returns its exit code.
private
runBlockingProcess(Process
$process, OutputInterface
$output) : int
Parameters
$process
:
Process
Description
the process to execute
$output
:
OutputInterface
Description
the output that SHALL receive process output
Return values
Description
The exit code returned by the process. A startup failure is normalized to a non-zero exit code.
Runs a blocking process inside a grouped GitHub Actions log section.
private
runLabeledBlockingProcess(Process
$process, OutputInterface
$output,
string
$label) : int
Parameters
$process
:
Process
Description
the process to execute
$output
:
OutputInterface
Description
the output that SHALL receive process output
$label
:
string
Description
the label that SHALL be used to group command output
Return values
Description
the resulting process exit code
Starts a process in detached mode without waiting for completion.
private
startDetachedProcess(Process
$process,
string
$label) : int
Description
A detached process is considered successfully dispatched when its startup sequence completes without throwing an exception.
Parameters
$process
:
Process
Description
the process to start
$label
:
string
Description
the label used when presenting the buffered output
Return values
Description
returns 0 when the process starts successfully, or a non-zero value when startup fails
Writes buffered detached output to the configured output.
private
writeDetachedOutput(
string
$standardOutput,
string
$errorOutput, OutputInterface
$output) : bool
Parameters
$standardOutput
:
string
$errorOutput
:
string
$output
:
OutputInterface
Description
the output that SHALL receive detached process output
Return values
Description
always returns true to support grouped callback usage