Hi,
In message "[ruby-talk:03040] Re: Problem with getc under UNIX with ruby 1.4.3"
on 00/05/30, "David Douthitt" <DDouthitt / cuna.com> writes:
|#!/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.
Try `alias'.
class IO
alias orig_getc getc
private :orig_getc
def getc
...
c = orig_getc
...
end
end