FakeRuntimeProvider class

Records start/stop calls and exposes a controllable events stream so a test emits SessionStarted/Exited/Died on demand. Only the members the effect touches are meaningful; the rest are honest no-ops over an empty surface.

Constructors

FakeRuntimeProvider()
Creates the fake provider with a broadcast event stream.

Properties

capabilities → RuntimeCapabilities
What this provider can reliably detect (gc's Capabilities()), so callers degrade explicitly.
no setter
eventListenerCount int
The number of live subscriptions to events (added and not yet cancelled). Lets a test prove the effect's per-incarnation subscription is actually torn down on dispose (PDR §7 (f) — the subscription-cancel half).
no setter
events Stream<RuntimeEvent>
The lifecycle event stream across ALL sessions this provider owns (demultiplex by RuntimeEvent.name). Broadcast: late subscribers see events from their subscription point on.
no setter
hashCode int
The hash code for this object.
no setterinherited
identities Map<String, ({int? pgid, int pid})>
The programmable OS identities identityOf reports for a LIVE session — a test stages identities[name] = (pid: …, pgid: …) to exercise the SessionAlreadyExists synchronous-resolution path (tg-090). Unstaged names report null.
final
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
started List<({RuntimeConfig config, String name})>
(name, config) of every start, in call order.
final
startGate Completer<void>?
A gate the test can hold to delay a start (proves the spawn ordering / races); when null, start completes immediately.
getter/setter pair
stopped List<String>
Every stopped session name, in call order.
final
throwOnStart Object?
When set, the next start throws this (e.g. SessionAlreadyExists).
getter/setter pair

Methods

close() Future<void>
Closes the broadcast event stream and drops all retained terminals (call from an addTearDown).
emit(RuntimeEvent event) → void
Emits event to subscribers (after a microtask, like a real stream). A terminal (Exited/Died) is LATCHED as retained state BEFORE the emission and deregisters the live session — exactly the real provider's _emitExit shape, so a zero-listener emission stays queryable through terminalOf.
identityOf(String name) → ({int? pgid, int pid})?
The OS identity of the named LIVE session — its leader pid and (when resolution succeeded at spawn) its pgid — or null when the session is unknown, already terminal, or its spawn has not yet stamped a pid.
interrupt(String name) Future<void>
Sends a soft interrupt (SIGINT / Ctrl-C) to the named session — graceful nudge-to-stop before stop. Best-effort: completes normally if the session does not exist.
isRunning(String name) bool
Whether the named provider runtime exists (a session record is held). Does not by itself prove the agent process is alive — use processAlive.
lastActivity(String name) DateTime?
The time of the last observed I/O activity in the named session, or null when unknown/unsupported. gc's GetLastActivity.
listRunning(String prefix) List<String>
The names of all running sessions whose name starts with prefix — orphan detection / listing. gc's ListRunning.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
output(String name) Stream<String>
The live transcript (merged stdout+stderr lines) of the named session. Broadcast per session; empty for an unknown session.
peek(String name, int lines) String
The last lines of captured output for the named session (all buffered output when lines <= 0); empty for an unknown session. gc's Peek.
processAlive(String name) bool
Whether the named session's agent process is currently live in the OS.
start(String name, RuntimeConfig config) Future<void>
Creates a new session named name with config. Completes when the process is spawned and its RuntimeEvent.sessionStarted has been emitted. Throws SessionAlreadyExists if a live session already holds name.
stop(String name) Future<void>
Destroys the named session and cleans up its process tree (SIGTERM→grace→SIGKILL of the whole group). Idempotent: completes normally if the session does not exist.
terminalOf(String name) → RuntimeEvent?
The RETAINED terminal of the named session — the exact RuntimeEvent.exited/RuntimeEvent.died this provider emitted for it, inferred flag and reason intact — or null while the session is live, unknown, or released.
toString() String
A string representation of this object.
inherited

Operators

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