-
Notifications
You must be signed in to change notification settings - Fork 29.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
readline: readline.close() result in process.stdout is unexpected #30701
Comments
//test.js
const readline = require("readline");
const rl = readline.createInterface({
input: process.stdin,
output: process.stdout
});
setTimeout(() => {
process.stdin.pause();
process.stdin.setRawMode(false);
setInterval(() => {
console.log("test");
}, 1000);
}, 1000);
const readline = require("readline");
const fs = require("fs");
const rl = readline.createInterface({
input: process.stdin,
output: process.stdout
});
setTimeout(() => {
process.stdin.pause();
process.stdin.setRawMode(false);
setInterval(() => {
fs.writeFileSync("./temp", "test2", { flag: "a" });
console.log("test");
}, 1000);
}, 1000); terminal output is empty,file $ cat ./temp
$ test2 I have looked at the docs,but I'm still confused with these result. Or if these are not bug, what is the recommend way to repeat use readline.createInterface and close readline ? |
execute |
Node 14.6 has fixed this problem. |
Bisected to a9ca420 (precisely libuv/libuv@aeab873). This issue is fixed and should be closed. |
Nice ! Thanks for the information. @chengzhuo5 @Hakerh400 |
Better like this: const rl = readline.createInterface({
input: process.stdin,
output: process.stdout,
terminal: false
}); |
win10 output(empty)
linux output
this code will block without any error
The text was updated successfully, but these errors were encountered: