start method

void start()

Subscribes to the session and primes the first prompt. Idempotent.

Implementation

void start() {
  if (_started) return;
  _started = true;
  _stdoutSub = _session.stdout.listen(_onStdout);
  _stderrSub = _session.stderr.listen(_onStderr);
  unawaited(
    _session.exitCode.then(_onExitCode).catchError((_) {
      _onExitCode(-1);
    }),
  );

  if (_resumedInAltScreen) {
    // Resuming into a full-screen program: the replayed output repaints it and
    // its already-queued completion marker restores the prompt when it exits.
    _inFlight = true;
    onPassthrough(true);
    return;
  }
  final init = _dialect.initLine;
  if (init != null) _send('$init\n');
  _send('${_dialect.fullMarker(_marker)}\n');
}