stop method
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.
Implementation
@override
Future<void> stop(String name) async {
stopped.add(name);
_live.remove(name);
_lifecycles.remove(name);
final interaction = _interaction.remove(name);
if (interaction != null && !interaction.isClosed) {
unawaited(interaction.close());
}
// stop RELEASES the retained terminal (the terminalOf release contract).
_terminals.remove(name);
_exitOutput.remove(name);
}