Skip to content

Commit

Permalink
fix: only call setRawMode if stdin is TTY (#301)
Browse files Browse the repository at this point in the history
  • Loading branch information
fstanis authored and gregberge committed Dec 18, 2019
1 parent 62a9b81 commit 61d04c7
Showing 1 changed file with 6 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -60,15 +60,19 @@ class PuppeteerEnvironment extends NodeEnvironment {
) {
stdin.removeListener('data', onKeyPress)
if (!listening) {
stdin.setRawMode(false)
if (stdin.isTTY) {
stdin.setRawMode(false)
}
stdin.pause()
}
resolve()
}
}
const listening = stdin.listenerCount('data') > 0
if (!listening) {
stdin.setRawMode(true)
if (stdin.isTTY) {
stdin.setRawMode(true)
}
stdin.resume()
stdin.setEncoding('utf8')
}
Expand Down

0 comments on commit 61d04c7

Please sign in to comment.