Skip to content

Kolu terminal left frozen (raw mode not restored) after a TUI child exits #1076

@srid

Description

@srid

Symptom

Run a raw-mode terminal UI inside a Kolu (split) terminal and quit it, and the terminal is left frozen — the shell prompt returns but no keystrokes are echoed or processed (the PTY is stuck in raw mode). You have to recreate the terminal.

Discovered while testing mini-ci, a small TUI (#1073): just run → press q to quit → terminal frozen, can't type anymore.

Minimal repro (independent of mini-ci)

A ~6-line Node program that sets raw mode and exits:

// freeze.mjs
process.stdin.setRawMode(true);
process.stdin.resume();
process.stdin.on('data', (b) => {
  if (b.toString() === 'q') { process.stdin.setRawMode(false); process.exit(0); }
});
console.log('raw mode on — press q to quit');
  1. Open a Kolu terminal, node freeze.mjs.
  2. Press q.
  3. Observed: the shell returns but is frozen — typed characters don't appear, Enter does nothing. (stty sane typed blind + Enter usually recovers it, which confirms a leftover termios state.)
  4. Expected: the terminal returns to cooked mode after the program exits — as it does in a standard emulator (xterm/alacritty/iTerm), where the shell restores its own termios when it regains the foreground.

Where to look / bisection

  • First confirm whether it reproduces only in a Kolu terminal vs a standard emulator with the same snippet. If Kolu-specific, the suspect is the pty-host's handling of a foreground child that exits in raw mode — a real terminal's shell self-heals via tcsetattr on regaining the foreground; something in the Kolu PTY path may not be letting that happen.
  • Relevant: packages/pty-host/ (PTY ownership) and the xterm.js client's input handling after a child exit.
  • App-side angle to rule out: calling process.exit() immediately after setRawMode(false) can in some runtimes race the tcsetattr reset — but a frozen shell (not just the TUI) points at the terminal layer, since the shell should self-heal regardless.

Notes

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions