feed method

void feed(
  1. String chunk
)

Feeds one output chunk (stdout and stderr alike — sudo prompts on stderr). Any output resets the quiet window: a pending fire is re-evaluated against the new tail.

Implementation

void feed(String chunk) {
  if (_disposed || chunk.isEmpty) return;
  _quietTimer?.cancel();
  _quietTimer = null;
  _window.write(chunk);
  var text = _window.toString();
  if (text.length > _windowCap) {
    text = text.substring(text.length - _windowCap);
    _window
      ..clear()
      ..write(text);
  }
  if (_awaitingAnswer) return;
  if (_promptAtLineEnd.firstMatch(text) == null) return;
  _quietTimer = Timer(quiet, _fire);
}