CLI: restore terminal state on exit

This commit is contained in:
Shakker
2026-02-03 06:10:19 +00:00
parent d5593d647c
commit 157d6d2db7
3 changed files with 54 additions and 0 deletions

View File

@@ -1,4 +1,5 @@
import { clearActiveProgressLine } from "./terminal/progress-line.js";
import { restoreTerminalState } from "./terminal/restore.js";
export type RuntimeEnv = {
log: typeof console.log;
@@ -16,6 +17,7 @@ export const defaultRuntime: RuntimeEnv = {
console.error(...args);
},
exit: (code) => {
restoreTerminalState("runtime exit");
process.exit(code);
throw new Error("unreachable"); // satisfies tests when mocked
},