Problem using HighLine for password prompt on Windows

I am trying to use the HighLine library for password prompting on
Windows and cannot make it work properly.

Environment:

  • Windows XP SP3
  • ruby 1.9.2p290 (2011-07-09) [i386-mingw32]
  • highline 1.6.9

Program:

require 'rubygems'
require 'highline/import'
p ask('Password: ') { |q| q.echo = '*' }

Problem:

When entering “12345” + Backspace twice + Enter at the prompt I get:

W:\work> ruby tst.rb
Password: ****←[←[P
"123"

When entering “12345” + Left Arrow twice + Enter at the prompt I get:

W:\work> ruby tst.rb
Password: *********
"12345\xE0K\xE0K"

This is not exactly what I was hoping for. If using HighLine with JRuby
the problem is more or less the same. Am I missing something or is
this a bug/limitation of HighLine?

Claus

Claus Folke B. wrote in post #1040663:

I am trying to use the HighLine library for password prompting on
Windows and cannot make it work properly.

No one has tried this?

Claus

On Mon, Jan 16, 2012 at 9:59 AM, Claus Folke B. [email protected]
wrote:

Claus Folke B. wrote in post #1040663:

I am trying to use the HighLine library for password prompting on
Windows and cannot make it work properly.

No one has tried this?

Claus

I haven’t, but I have a hunch this has something to do with terminal
escape sequences in Windows vs. those in *nix.

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs