Hi --

On 5/7/05, James Edward Gray II <james / grayproductions.net> wrote:
> On May 7, 2005, at 8:10 PM, Ryan Leavengood wrote:
> 
> > I get the same result on Windows, so I suspect Ruby is doing some
> > stuff behind the scenes. You may want to try my password prompter
> > with the getch of the curses libraries on a Unix box just to be sure.
> 
> Duh.  You're right:
> 
> $ ruby -e 'system "stty raw"; p $stdin.getc; syst "stty -raw"'
> 13

You might not want to use stty in that exact way. From the stty
manpage (on OSX):

Note that since the terminal driver no longer has a single RAW bit, it
is not possible to intuit what flags were set prior to setting raw. 
This means that unsetting raw may not put back all the setting that
were previously in effect.  To set the terminal into a raw state and
then accurately restore it, the following shell code is recommended:

    save_state=$(stty -g)
    stty raw
    ...
    stty "$save_state"

So the equivalent ruby code:

    state = `stty -g`
    system "stty raw"
    ...
    system "stty #{state}"

cheers,
Mark