Issue #236 - Handle Ctrl-C when Question#echo = false (raw_no_echo_mode) #259
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Fix #236
Hi @Fahhetah,
I've set the author's commit to your e-mail to honor your suggestion.
But I've changed
exit 130
toraise Interrupt
so it stays in line with Ruby standard behavior when receiving ctrl-C.I'll not merge it yet as I'm investigating a little further if I could have a better more complete approach.
Because treating all ctrl codes one by one seems not a good way for the long run.
cc: @Faheetah @Thalagyrt @aspyct
Of note, this commit message:
Handle interrupts directly at io/console was possible with the introduction of
intr
option togetch
.Added to io/console at commit at 24, September, 2019
Released in Ruby 2.7.0, released at 25, December, 2019
Documented at 17, February, 2020
Documented in Ruby 2.7.1, released at 31, March, 2020
We should review all the code for other instances of handling control inputs like getch when echo is not false.
And, we will probably have to think about deprecating rubies older than 2.7 because they will have a different behavior. (Although the tests are passing because we use a mock with StringIO objects, not the actual consoles.