Skip to content

Commit a0b4c9d

Browse files
committed
fix: avoid setRawMode if stdin is not a tty
1 parent 687bce2 commit a0b4c9d

File tree

1 file changed

+8
-2
lines changed
  • plugins/plugin-codeflare-dashboard/src/components/Top

1 file changed

+8
-2
lines changed

Diff for: plugins/plugin-codeflare-dashboard/src/components/Top/index.tsx

+8-2
Original file line numberDiff line numberDiff line change
@@ -105,12 +105,18 @@ class Top extends React.PureComponent<Props, State> {
105105
}
106106

107107
private cleanupKeyboardEvents() {
108-
// TODO do we also need to exit raw mode on ctrl+c?
109-
process.stdin.setRawMode(false)
108+
if (process.stdin.isTTY) {
109+
// TODO do we also need to exit raw mode on ctrl+c?
110+
process.stdin.setRawMode(false)
111+
}
110112
}
111113

112114
/** Handle keyboard events from the user */
113115
private initKeyboardEvents() {
116+
if (!process.stdin.isTTY) {
117+
return
118+
}
119+
114120
// these are necessary to get keypress events on process.stdin
115121
emitKeypressEvents(process.stdin)
116122
process.stdin.setRawMode(true)

0 commit comments

Comments
 (0)