Skip to content

Commit

Permalink
fix(compas): don't assume stdin has 'setRawMode'
Browse files Browse the repository at this point in the history
  • Loading branch information
dirkdev98 committed Sep 3, 2023
1 parent 0c59d09 commit eba39e8
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions packages/compas/src/main/development/tui.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,9 @@ export function tuiInit(state) {
process.stdout.on("resize", () => state.resizeScreen());

// Input setup + listener
process.stdin.setRawMode(true);
if (process.stdin.setRawMode) {
process.stdin.setRawMode(true);
}
emitKeypressEvents(process.stdin);

process.stdin.on("keypress", (char, raw) => {
Expand All @@ -52,7 +54,10 @@ export function tuiExit(state) {

state.cursor.reset();
state.cursor.flush();
process.stdin.setRawMode(false);

if (process.stdin.setRawMode) {
process.stdin.setRawMode(false);
}
}

/**
Expand Down

0 comments on commit eba39e8

Please sign in to comment.