How to use cbreak mode in Ruby terminal application?
Posted
by
Thomas
on Stack Overflow
See other posts from Stack Overflow
or by Thomas
Published on 2011-01-05T15:32:24Z
Indexed on
2011/01/05
17:53 UTC
Read the original article
Hit count: 208
In a small Ruby application, I'd like user input to be accepted without having to wait for a carriage return. My understanding is that cbreak mode needs to be enabled in order for the terminal to feed user input directly into the script.
I tried simply running x%[cbreak()] at the top of my script but that didn't work. I've also seen that it's possible to use (n)curses to achieve the same results, although that seems like overkill.
Does anybody have a suggestion on how to implement this?
Thanks
© Stack Overflow or respective owner