ProcessRunner class

A helper class for classes that want to run a process, optionally have the stderr and stdout printed to stdout/stderr as the process runs, and capture the stdout, stderr, and interleaved output properly without dropping any.

Constructors

ProcessRunner({Directory? defaultWorkingDirectory, ProcessManager processManager = const LocalProcessManager(), Map<String, String>? environment, bool includeParentEnvironment = true, bool printOutputDefault = false, Encoding decoder = const SystemEncoding()})

Properties

decoder Encoding
The decoder to use for decoding result stderr, stdout, and output.
final
defaultWorkingDirectory Directory
Sets the default directory used when workingDirectory is not specified to runProcess.
final
environment Map<String, String>
The environment to run processes with.
final
hashCode int
The hash code for this object.
no setterinherited
includeParentEnvironment bool
If true, merges the given environment into the parent environment.
final
printOutputDefault bool
If set, indicates that, by default, commands will both write the output to stdout/stderr, as well as return it in the ProcessRunnerResult.stderr, ProcessRunnerResult.stderr members.
final
processManager → ProcessManager
Set the processManager in order to allow injecting a test instance to perform testing.
final
runtimeType Type
A representation of the runtime type of the object.
no setterinherited

Methods

noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
runProcess(List<String> commandLine, {Directory? workingDirectory, bool? printOutput, bool failOk = false, Stream<List<int>>? stdin, bool runInShell = false, ProcessStartMode startMode = ProcessStartMode.normal}) Future<ProcessRunnerResult>
Run the command and arguments in commandLine as a sub-process from workingDirectory if set, or the defaultWorkingDirectory if not. Uses Directory.current if defaultWorkingDirectory is not set.
toString() String
A string representation of this object.
inherited

Operators

operator ==(Object other) bool
The equality operator.
inherited