-
-
Notifications
You must be signed in to change notification settings - Fork 272
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
Fix discardStdin
option
#135
Conversation
I'll be keeping some notes regarding the multiple issues here. Starting with: However, here is the minimal reproduction: const noop = () => {};
process.stdin.on('data', noop);
process.stdin.removeListener('data', noop); This code alone hangs event loop. I don't know if it's expected behavior, the documentation on that is somewhat vague. |
Hangs under windows. const readline = require('readline');
const input = process.stdin;
const output = process.stdout;
let rl = readline.createInterface({input, output});
setTimeout(() => { // causes no problem if ran on process.nextTick or on the same tick
rl.close();
let rl2 = readline.createInterface({input, output}); //hangs
process.exit(0); // this line will never be executed
}, 0); |
@sindresorhus What do you think about just disabling this feature on Windows? I've spent a few days debugging it but I still fail to produce even minimal reproduction(a lot of different actions seem to trigger it). My current understanding is that the problem is either entirely in |
Yes, sounds good. I just want to get out a fix. We can open an issue afterwards in case anyone wants to look into adding Windows support to the option. |
Anything blocking this PR from being merged? |
@stroncium Would you be able to finish this by just disabling it on Windows? |
@sindresorhus Yeah,just figured you were swamped with PRs and took a bit more time to investigate(nothing helpful tho, so sticking with disabling for windows still). |
Disable
discardStdin
option on Windows. BTW, when usingcmd
nothing is printed anyway on Windows(unless in raw mode I suppose). Fixes #132, fixes #134, fixes #136.Problem mostly boiled down to using raw mode twice(on separate ticks) hanged the problem under windows. Relevant change added to
example.js
(tested incmd
).Make discarding work with multiple parallel
ora
instances, fixes #133.#134 is a problem under macs too, looking into it right now.