Project

General

Profile

Actions

Bug #5626

closed

io/console: Cannot disable raw mode

Added by mistydemeo (Misty De Meo) almost 13 years ago. Updated over 12 years ago.

Status:
Closed
Target version:
ruby -v:
ruby 1.9.3p0 (2011-10-30 revision 33570) [x86_64-darwin11.2.0]
Backport:
[ruby-core:40992]

Description

There doesn't seem to be a way to disable tty raw mode from within a Ruby script. The tty can be stuck in raw mode on script termination if IO.console.raw! is used, or if a raw command like IO.console.getch is in a thread that is terminated.

The documentation recommends following IO.console.raw! with #raw { ... } to restore the terminal, but this does not restore the terminal, either if IO.console.raw! is used or if a raw command is interrupted.

While I can use an external command like system("stty -raw"), I would rather be able to do this within IO.console. I can disable echo with IO.console.echo=, but that doesn't affect the raw mode.

Updated by nobu (Nobuyoshi Nakada) almost 13 years ago

  • Status changed from Open to Feedback
  • Assignee set to nobu (Nobuyoshi Nakada)
  • Target version set to 2.0.0

Misty De Meo wrote:

There doesn't seem to be a way to disable tty raw mode from within a Ruby script. The tty can be stuck in raw mode on script termination if IO.console.raw! is used, or if a raw command like IO.console.getch is in a thread that is terminated.

Sure, it can be.
I'll add IO#cooked and IO#cooked! methods.
Thank you for pointing out.

The documentation recommends following IO.console.raw! with #raw { ... } to restore the terminal, but this does not restore the terminal, either if IO.console.raw! is used or if a raw command is interrupted.

It sounds like a bug.
How can I reproduce it?

Updated by nobu (Nobuyoshi Nakada) over 12 years ago

  • Status changed from Feedback to Closed
Actions

Also available in: Atom PDF

Like0
Like0Like0