TestProcess class

A wrapper for Process that provides a convenient API for testing its standard IO and interacting with it from a test.

If the test fails, this will automatically print out any stdout and stderr from the process to aid debugging.

This may be extended to provide custom implementations of stdoutStream and stderrStream. These will automatically be picked up by the stdout and stderr queues, but the debug log will still contain the original output.

Constructors

TestProcess(Process process, String description, { Encoding encoding, bool forwardStdio: false })
Creates a TestProcess for process. [...]

Properties

description → String
A human-friendly description of this process.
final
exitCode → Future<int>
Returns a Future which completes to the exit code of the process, once it completes.
read-only
pid → int
The process ID of the process.
read-only
stderr StreamQueue<String>
A StreamQueue that emits each line of stderr from the process. [...]
read-only
stdin → IOSink
The standard input sink for this process.
read-only
stdout StreamQueue<String>
A StreamQueue that emits each line of stdout from the process. [...]
read-only
hashCode → int
The hash code for this object.
read-only, inherited
runtimeType → Type
A representation of the runtime type of the object.
read-only, inherited

Methods

kill() → Future
Kills the process (with SIGKILL on POSIX operating systems), and returns a future that completes once it's dead. [...]
shouldExit([dynamic expectedExitCode ]) → Future
Waits for the process to exit, and verifies that the exit code matches expectedExitCode (if given). [...]
signal(ProcessSignal signal) → void
Sends signal to the process. [...]
stderrStream() → Stream<String>
Returns a copy of stderr as a single-subscriber stream. [...]
stdoutStream() → Stream<String>
Returns a copy of stdout as a single-subscriber stream. [...]
noSuchMethod(Invocation invocation) → dynamic
Invoked when a non-existent method or property is accessed.
inherited
toString() → String
Returns a string representation of this object.
inherited

Operators

operator ==(dynamic other) → bool
The equality operator.
inherited

Static Methods

start(String executable, Iterable<String> arguments, { String workingDirectory, Map<String, String> environment, bool includeParentEnvironment: true, bool runInShell: false, String description, Encoding encoding, bool forwardStdio: false }) → Future<TestProcess>
Starts a process. [...]