Skip to content

Commit eba39e8

Browse files
committed
fix(compas): don't assume stdin has 'setRawMode'
1 parent 0c59d09 commit eba39e8

File tree

1 file changed

+7
-2
lines changed
  • packages/compas/src/main/development

1 file changed

+7
-2
lines changed

packages/compas/src/main/development/tui.js

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,9 @@ export function tuiInit(state) {
2525
process.stdout.on("resize", () => state.resizeScreen());
2626

2727
// Input setup + listener
28-
process.stdin.setRawMode(true);
28+
if (process.stdin.setRawMode) {
29+
process.stdin.setRawMode(true);
30+
}
2931
emitKeypressEvents(process.stdin);
3032

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

5355
state.cursor.reset();
5456
state.cursor.flush();
55-
process.stdin.setRawMode(false);
57+
58+
if (process.stdin.setRawMode) {
59+
process.stdin.setRawMode(false);
60+
}
5661
}
5762

5863
/**

0 commit comments

Comments
 (0)