FakeProcessManager class

A mock that can be used to fake a process manager that runs commands and returns results.

Call verifyCalls to verify that each desired call occurred.

Constructors

FakeProcessManager(StringReceivedCallback stdinResults, {bool commandsThrow = false})

Properties

commandsThrow bool
Set to true if all commands run with this process manager should throw an exception.
getter/setter pair
fakeResults Map<FakeInvocationRecord, List<ProcessResult>>
getter/setter pair
hashCode int
The hash code for this object.
no setterinherited
invocations List<FakeInvocationRecord>
The list of invocations that occurred, in the order they occurred.
getter/setter pair
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
stdinResults StringReceivedCallback
The callback that will be called each time stdin input is supplied to a call.
final

Methods

canRun(dynamic executable, {String? workingDirectory}) bool
Returns true if the executable exists and if it can be executed.
killPid(int pid, [ProcessSignal signal = ProcessSignal.sigterm]) bool
Kills the process with id pid.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
run(List command, {String? workingDirectory, Map<String, String>? environment, bool includeParentEnvironment = true, bool runInShell = false, Encoding? stdoutEncoding = systemEncoding, Encoding? stderrEncoding = systemEncoding}) Future<ProcessResult>
Starts a process and runs it non-interactively to completion.
runSync(List command, {String? workingDirectory, Map<String, String>? environment, bool includeParentEnvironment = true, bool runInShell = false, Encoding? stdoutEncoding = systemEncoding, Encoding? stderrEncoding = systemEncoding}) ProcessResult
Starts a process and runs it to completion. This is a synchronous call and will block until the child process terminates.
start(List command, {String? workingDirectory, Map<String, String>? environment, bool includeParentEnvironment = true, bool runInShell = false, ProcessStartMode mode = ProcessStartMode.normal}) Future<Process>
Starts a process by running the specified command.
toString() String
A string representation of this object.
inherited
verifyCalls(Iterable<FakeInvocationRecord> calls) → void
Verify that the given command lines were called, in the given order, and that the parameters were in the same order.

Operators

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