-
Notifications
You must be signed in to change notification settings - Fork 30k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Before PR 20592, closing all handles associated with the main event loop would also mean that `uv_tty_reset_mode()` can’t function properly because the corresponding FDs have already been closed. Add regression tests for this condition. Refs: #21020 Refs: #20592 PR-URL: #21027 Reviewed-By: Anatoli Papirovski <apapirovski@mac.com> Reviewed-By: James M Snell <jasnell@gmail.com>
- Loading branch information
Showing
6 changed files
with
61 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
'use strict'; | ||
require('../common'); | ||
const child_process = require('child_process'); | ||
|
||
// Tests that exiting through process.exit() resets the TTY mode. | ||
|
||
child_process.spawnSync(process.execPath, [ | ||
'-e', 'process.stdin.setRawMode(true); process.exit(0)' | ||
], { stdio: 'inherit' }); | ||
|
||
const { stdout } = child_process.spawnSync('stty', { | ||
stdio: ['inherit', 'pipe', 'inherit'], | ||
encoding: 'utf8' | ||
}); | ||
|
||
if (stdout.match(/-echo\b/)) { | ||
console.log(stdout); | ||
} |
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
'use strict'; | ||
const common = require('../common'); | ||
const child_process = require('child_process'); | ||
|
||
// Tests that exiting through a catchable signal resets the TTY mode. | ||
|
||
const proc = child_process.spawn(process.execPath, [ | ||
'-e', 'process.stdin.setRawMode(true); console.log("Y"); while(true) {}' | ||
], { stdio: ['inherit', 'pipe', 'inherit'] }); | ||
|
||
proc.stdout.on('data', common.mustCall(() => { | ||
proc.kill('SIGINT'); | ||
})); | ||
|
||
proc.on('exit', common.mustCall(() => { | ||
const { stdout } = child_process.spawnSync('stty', { | ||
stdio: ['inherit', 'pipe', 'inherit'], | ||
encoding: 'utf8' | ||
}); | ||
|
||
if (stdout.match(/-echo\b/)) { | ||
console.log(stdout); | ||
} | ||
})); |
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
'use strict'; | ||
require('../common'); | ||
const child_process = require('child_process'); | ||
|
||
// Tests that exiting through normal means resets the TTY mode. | ||
// Refs: https://github.com/nodejs/node/issues/21020 | ||
|
||
child_process.spawnSync(process.execPath, [ | ||
'-e', 'process.stdin.setRawMode(true)' | ||
], { stdio: 'inherit' }); | ||
|
||
const { stdout } = child_process.spawnSync('stty', { | ||
stdio: ['inherit', 'pipe', 'inherit'], | ||
encoding: 'utf8' | ||
}); | ||
|
||
if (stdout.match(/-echo\b/)) { | ||
console.log(stdout); | ||
} |
Empty file.