zyedidia / eget

Easily install prebuilt binaries from GitHub.
MIT License
866 stars 39 forks source link

Exit with an error if scanf fails #59

Closed larsks closed 1 year ago

larsks commented 1 year ago

Exit if scanf returns an error, rather than going into an infinite loop if we are unable to read from stdin.

Closes #58

zyedidia commented 1 year ago

I think this is reasonable but it should only exit if the error is io.EOF. If it's a different error, like a failure to parse an integer, that should be reported to the user without exiting.

larsks commented 1 year ago

I've updated the code to only exit when we hit an EOF error. The existing code correctly produces warnings for other sorts of invalid input.