MCPcopy Index your code
hub / github.com/CodebuffAI/codebuff / resetTerminal

Function resetTerminal

cli/release/index.js:34–57  ·  view source on GitHub ↗
(options = {})

Source from the content-addressed store, hash-verified

32 EXIT_ALTERNATE_SCREEN_SEQUENCE + SAFE_TERMINAL_RESET_SEQUENCES
33
34function resetTerminal(options = {}) {
35 const { exitAlternateScreen = false } = options
36
37 try {
38 if (process.stdin.isTTY && process.stdin.setRawMode) {
39 process.stdin.setRawMode(false)
40 }
41 } catch {
42 // stdin may be closed
43 }
44 try {
45 if (process.stdout.isTTY) {
46 // Exiting the alternate screen is only safe after an interactive child.
47 // Plain CLI paths like --help never enter it, and ?1049l can erase output.
48 process.stdout.write(
49 exitAlternateScreen
50 ? FULL_TERMINAL_RESET_SEQUENCES
51 : SAFE_TERMINAL_RESET_SEQUENCES,
52 )
53 }
54 } catch {
55 // stdout may be closed
56 }
57}
58
59function getUnsignedExitCode(code) {
60 return code != null && code < 0 ? (code >>> 0) : code

Callers 3

checkForUpdatesFunction · 0.70
printSpawnFailureFunction · 0.70
exitListenerFunction · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected