Thanks for the help! Now I'm trying to redefine IO.getc to include this behavior.... and not getting very far:
#!/usr/bin/ruby
class IO
def getc
begin
system("stty raw -echo")
str = self.getc
ensure
system("stty -raw echo")
end
end
end
str = STDIN.getc
p str
This code locks up - I think probably for semi-obvious reasons (self.getc IN getc) but I don't know how to call the "previous" getc from within a redefinition. I tried super and it said there wasn't any.