Skip to content

Commit 4ca959b

Browse files
andyearnshawcpojer
authored andcommitted
Revert setRawMode on --watch quit (fixes #5028) (#5029)
* Revert setRawMode on --watch ctrl-c (#5028) * Disable stdin raw mode in watch quit plugin (#5028) * Update changelog
1 parent 84e9789 commit 4ca959b

3 files changed

Lines changed: 8 additions & 0 deletions

File tree

CHANGELOG.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@
44

55
### Fixes
66

7+
* `[jest-cli]` Fix inability to quit watch mode while debugger is still attached
8+
([#5029](https://github.com/facebook/jest/pull/5029))
79
* `[jest-haste-map]` Properly handle platform-specific file deletions
810
([#5534](https://github.com/facebook/jest/pull/5534))
911

packages/jest-cli/src/plugins/quit.js

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,9 @@ import WatchPlugin from '../watch_plugin';
1010

1111
class QuitPlugin extends WatchPlugin {
1212
async showPrompt() {
13+
if (typeof this._stdin.setRawMode === 'function') {
14+
this._stdin.setRawMode(false);
15+
}
1316
this._stdout.write('\n');
1417
process.exit(0);
1518
}

packages/jest-cli/src/watch.js

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -230,6 +230,9 @@ export default function watch(
230230

231231
const onKeypress = (key: string) => {
232232
if (key === KEYS.CONTROL_C || key === KEYS.CONTROL_D) {
233+
if (typeof stdin.setRawMode === 'function') {
234+
stdin.setRawMode(false);
235+
}
233236
outputStream.write('\n');
234237
exit(0);
235238
return;

0 commit comments

Comments
 (0)