Skip to content

Commit

Permalink
Add check for setRawMode function before unsetting
Browse files Browse the repository at this point in the history
  • Loading branch information
andyearnshaw authored Dec 6, 2017
1 parent 07ec4c6 commit b172147
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions packages/jest-cli/src/watch.js
Original file line number Diff line number Diff line change
Expand Up @@ -152,7 +152,9 @@ export default function watch(
let activePlugin: ?WatchPlugin;
const onKeypress = (key: string) => {
if (key === KEYS.CONTROL_C || key === KEYS.CONTROL_D) {
stdin.setRawMode(false);
if (typeof stdin.setRawMode === 'function') {
stdin.setRawMode(false);
}
process.exit(0);
return;
}
Expand Down Expand Up @@ -194,7 +196,9 @@ export default function watch(

switch (key) {
case KEYS.Q:
stdin.setRawMode(false);
if (typeof stdin.setRawMode === 'function') {
stdin.setRawMode(false);
}
process.exit(0);
return;
case KEYS.ENTER:
Expand Down

0 comments on commit b172147

Please sign in to comment.