pi-mono/packages/tui/test/fixtures/exit-without-stop.ts
Mario Zechner 9df819de39 fix(tui): restore terminal modes when the process exits without stop()
Registers a process exit fallback that synchronously writes mouse, focus,
bracketed paste, Kitty keyboard, and alternate-screen resets.

closes #11170
2026-10-20 19:52:54 +02:00

7 lines
304 B
TypeScript

import { ProcessTerminal } from "../../src/terminal.ts";
import { TuiAltScreen } from "../../src/tui-alt-screen.ts";
const tui = new TuiAltScreen(new ProcessTerminal(), false, undefined, { mouse: true });
tui.start();
if (process.argv[2] === "stop") tui.stop({ preserveScreen: true });
process.exit(0);