resize method
Resizes the terminal, where the backend supports it (no-op otherwise).
Implementation
@override
void resize({required int cols, required int rows}) {
final path = _ttyPath();
if (path == null) return; // tty path not recorded yet / resize disabled.
// `-F` (GNU/util-linux) vs `-f` (BSD/macOS) selects the device to operate on.
// Setting the size triggers TIOCSWINSZ → SIGWINCH to the foreground program.
final flag = Platform.isLinux ? '-F' : '-f';
try {
Process.runSync('stty', [flag, path, 'rows', '$rows', 'cols', '$cols']);
} on Object {
// Best-effort: a transient stty failure must never break the session.
}
}