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
off-by-one error causes Node to hang after progress is complete (0.1.0 regression) #19
Comments
meh doesn't matter to me I dont use this anymore, I can add you as a committer if you want |
IMO fuck windows, it just messes with all simple things |
Uh, sure. Using readline was just for windows, so maybe we should just revert the readline change? |
lol I just ran into this issue.. perfect timing! |
Would it be possible to publish a 0.1.1 release with this fix? |
This is a regression in 0.1.0 from 0.0.5.
Since
progress
now usesreadline
, itresume
s stdin when you start your bar and tries topause
it again (viathis.rl.close()
) when the bar is complete. However, due to an off-by-one error, it doesn't actually callthis.rl.close
until 1 tick past total. So if you are usingprogress
in a simple command-line tool which otherwise doesn't use stdin, usingprogress
0.1.0 means thatstdin
will be leftresume
d and your program will hang. For example, the following program:hangs with 0.1.0 but not with 0.0.5.
The simplest fix for this would be to change the
// progress complete
code fromto
However, it seems unfortunate that progress has to interact with stdin at all. Maybe just don't use
readline
? Or instead of passingprocess.stdin
toreadline
, pass a dummy object that ignores the methods that are called on it?I'm happy to submit a pull request to do any of the above, depending on which makes most sense to you.
The text was updated successfully, but these errors were encountered: