-
Notifications
You must be signed in to change notification settings - Fork 30.4k
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
How to unref readline? #36154
Comments
Solved via |
Although I think it would be nice to add this to docs, so I'll reopen. |
@szmarczak I think instead of hanging, the program is waiting for the end of const readline = require('readline');
const input = readline.createInterface({
input: process.stdin
});
input.on('line', (line) => {
console.log(line);
}) Here is the log of a run: ❯ time echo 'here is a line'|node index
here is a line
echo 'here is a line' 0.00s user 0.00s system 33% cpu 0.002 total
node index 0.07s user 0.02s system 63% cpu 0.140 total |
@szmarczak if still need to address this issue and add this functionality to the doc I would like to take this and open a PR. |
At the end of |
I have added the example. Please let me know if it needs an update. |
@aduh95 I see your review on the referenced PR, I can open a new PR addressing your comments there. Can I be assigned to this? |
@AnupamaP By all means, go for it :) |
@aduh95 thanks, would appreciate your thoughts on my PR :) |
Is your feature request related to a problem? Please describe.
The code above just hangs.
Describe the solution you'd like
const readline = require('readline'); const input = readline.createInterface({ input: process.stdin }); +input.unref();
Describe alternatives you've considered
None yet.
The text was updated successfully, but these errors were encountered: