ComposerProcessRunner
in package
implements
OutputCapturingProcessRunner
Runs commands through Composer's process executor.
Table of Contents
Interfaces
- OutputCapturingProcessRunner
- Runs external commands and captures standard output.
Properties
- $processExecutor : ProcessExecutor
- Executes escaped shell commands.
- $ttyDetector : callable(): bool
- Detects TTY support for interactive commands.
Methods
- __construct() : mixed
- Creates a Composer-backed process runner.
- getErrorOutput() : string
- Gets the last process error output.
- run() : int
- Runs a command with optional TTY passthrough.
- runWithOutput() : int
- Runs a command while capturing standard output.
- supportsTty() : bool
- Checks whether TTY execution is available.
- detectTtySupport() : bool
- Detects TTY support in the current Composer process.
- escapeCommand() : string
- Escapes command arguments for Composer's shell executor.
Properties
$processExecutor
Executes escaped shell commands.
private
ProcessExecutor
$processExecutor
$ttyDetector
Detects TTY support for interactive commands.
private
callable(): bool
$ttyDetector
Returns true when TTY passthrough is available.
Methods
__construct()
Creates a Composer-backed process runner.
public
__construct(IOInterface $io[, callable(): bool|null $ttyDetector = null ]) : mixed
Parameters
- $io : IOInterface
-
The Composer IO used by the process executor.
- $ttyDetector : callable(): bool|null = null
-
The TTY support detector, or
nullfor platform detection.
getErrorOutput()
Gets the last process error output.
public
getErrorOutput() : string
Return values
string —Returns stderr captured from the last executed command.
run()
Runs a command with optional TTY passthrough.
public
run(array<int, string> $command[, bool $tty = false ]) : int
Parameters
- $command : array<int, string>
-
The command arguments to escape and execute.
- $tty : bool = false
-
Whether to request TTY passthrough when supported.
Return values
int —Returns the process exit code.
runWithOutput()
Runs a command while capturing standard output.
public
runWithOutput(array<int, string> $command, string &$output) : int
Parameters
- $command : array<int, string>
-
The command arguments to escape and execute.
- $output : string
-
The captured standard output.
Return values
int —Returns the process exit code.
supportsTty()
Checks whether TTY execution is available.
public
supportsTty() : bool
Return values
bool —Returns true when Composer supports TTY execution and the terminal is a TTY.
detectTtySupport()
Detects TTY support in the current Composer process.
private
static detectTtySupport() : bool
Return values
bool —Returns true when the current process output is attached to a TTY.
escapeCommand()
Escapes command arguments for Composer's shell executor.
private
escapeCommand(array<int, string> $command) : string
Parameters
- $command : array<int, string>
-
The raw command arguments to escape.
Return values
string —Returns a shell-safe command string.