Skip to content

Commit

Permalink
fix: skip shortcuts on non-tty stdin (vitejs#11263)
Browse files Browse the repository at this point in the history
  • Loading branch information
ArnaudBarre authored and futurGH committed Feb 26, 2023
1 parent 545f7ac commit 20ca471
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions packages/vite/src/node/shortcuts.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,9 @@ export function bindShortcuts(
server: ViteDevServer,
opts: BindShortcutsOptions,
): void {
if (!server.httpServer) return
if (!server.httpServer || !process.stdin.isTTY || process.env.CI) {
return
}
server._shortcutsOptions = opts

if (opts.print) {
Expand Down Expand Up @@ -71,9 +73,7 @@ export function bindShortcuts(
actionRunning = false
}

if (process.stdin.isTTY) {
process.stdin.setRawMode(true)
}
process.stdin.setRawMode(true)

process.stdin.on('data', onInput).setEncoding('utf8').resume()

Expand Down

0 comments on commit 20ca471

Please sign in to comment.