Skip to content

Commit ab12215

Browse files
committed
fix(demo/ctx): guard setRawMode behind isTTY check to avoid crash in non-TTY
Made-with: Cursor
1 parent b37ac29 commit ab12215

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

demo/ctx/src/cli.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,11 @@ export async function selectMenu(question: string, options: string[], defaultInd
6363
render();
6464

6565
return new Promise((resolve) => {
66+
if (!process.stdin.isTTY) {
67+
resolve(defaultIndex);
68+
return;
69+
}
70+
6671
process.stdin.setRawMode(true);
6772
process.stdin.resume();
6873
process.stdin.setEncoding("utf-8");

0 commit comments

Comments
 (0)