MCPcopy Create free account
hub / github.com/tiann/hapi / restoreTerminalState

Function restoreTerminalState

cli/src/ui/terminalState.ts:1–16  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

1export function restoreTerminalState(): void {
2 if (process.stdout.isTTY) {
3 // Disable kitty keyboard protocol / CSI u key release reporting if enabled.
4 process.stdout.write('\x1b[>4;0m');
5 // Disable focus reporting to avoid stray ^[[I on mode switches.
6 process.stdout.write('\x1b[?1004l');
7 process.stdout.write('\x1b[?2004l');
8 }
9 if (process.stdin.isTTY) {
10 try {
11 process.stdin.setRawMode(false);
12 } catch {
13 // Ignore if raw mode is not supported.
14 }
15 }
16}

Callers 3

finalizeTerminalFunction · 0.90
spawnWithTerminalGuardFunction · 0.90
cleanupFunction · 0.90

Calls 1

writeMethod · 0.80

Tested by

no test coverage detected