Should irb work on Windows?

292 views
Skip to first unread message

Chris Perkins

unread,
Dec 2, 2010, 4:53:44 PM12/2/10
to RubyInstaller
Maybe it's just me, but irb doesn't seem to be very usable with
rubyinstaller-1.8.7-p302.exe. The main problem is that I cannot
backspace - if I do, I just get some weird control characters on the
command line - it looks like a little arrow, then a square bracket and
a capital D.

Is this normal? Or is there something wrong with my system that I can
fix?

This is with the normal windows cmd window, on XP.

Thank you,

Chris Perkins


Luis Lavena

unread,
Dec 2, 2010, 5:39:33 PM12/2/10
to rubyin...@googlegroups.com

IRB does works on Windows :-)

All the latest releases of RubyInstaller included a pure-ruby version
of readline (rb-readline):

http://github.com/luislavena/rb-readline

And IRB uses that version of readline.

I have a few questions for you:

* What codepage are you working on? (chcp)
* What font is your command prompt using (raster or TrueType)
* Do you have any .inputrc file located in your home directory? If so,
please show the contents
* Do you have any .irbrc located in your home directory? If so, please
show the contents
* Specifically, what version of Windows are you running? 32 or 64bits,
what language, etc.

Thank you.
--
Luis Lavena
AREA 17
-
Perfection in design is achieved not when there is nothing more to add,
but rather when there is nothing more to take away.
Antoine de Saint-Exupéry

MarcRic

unread,
Dec 3, 2010, 6:34:14 AM12/3/10
to RubyInstaller
Well, about weird behavior using irb...

I'm using 1.9.2p0, and when I press tab twice (using console or
directly in command prompt), it shows a "DIR" content.

Is this an expected result?

Here is the evidence: http://twitpic.com/3cg4yf

Regards.

--
MarcRic
www.marcric.com
http://marcricblog.blogspot.com/
http://www.traineronrails.com/
http://groups.google.com.br/group/riorubyrails



On Dec 2, 8:39 pm, Luis Lavena <luislav...@gmail.com> wrote:

Luis Lavena

unread,
Dec 3, 2010, 6:36:21 AM12/3/10
to rubyin...@googlegroups.com
On Fri, Dec 3, 2010 at 8:34 AM, MarcRic <mar...@gmail.com> wrote:
> Well, about weird behavior using irb...
>
> I'm using 1.9.2p0, and when I press tab twice (using console or
> directly in command prompt), it shows a "DIR" content.
>
> Is this an expected result?

Yes.

It has file system autocompletion, like bash on the terminal and what
readline supposed to do but never worked on Windows.

Chris Perkins

unread,
Dec 3, 2010, 9:57:07 AM12/3/10
to RubyInstaller
On Dec 2, 5:39 pm, Luis Lavena <luislav...@gmail.com> wrote:
> On Thu, Dec 2, 2010 at 6:53 PM, Chris Perkins <chrisperkin...@gmail.com> wrote:
> > Maybe it's just me, but irb doesn't seem to be very usable with
> > rubyinstaller-1.8.7-p302.exe.  The main problem is that I cannot
> > backspace - if I do, I just get some weird control characters on the
> > command line - it looks like a little arrow, then a square bracket and
> > a capital D.
>
> > Is this normal? Or is there something wrong with my system that I can
> > fix?
>
> > This is with the normal windows cmd window, on XP.
>
> IRB does works on Windows :-)
>
> All the latest releases of RubyInstaller included a pure-ruby version
> of readline (rb-readline):
>
> http://github.com/luislavena/rb-readline
>
> And IRB uses that version of readline.
>
> I have a few questions for you:
>
> * What codepage are you working on? (chcp)

C:\chris>chcp
Active code page: 437

> * What font is your command prompt using (raster or TrueType)

TrueType

> * Do you have any .inputrc file located in your home directory? If so,
> please show the contents

Yes, I do. I have never heard of it, and have no idea how it got
there, but here is what it contains:

set blink-matching-paren on

> * Do you have any .irbrc located in your home directory? If so, please
> show the contents

No.

> * Specifically, what version of Windows are you running? 32 or 64bits,
> what language, etc.

32 bit XP.

>
> Thank you.
> --
> Luis Lavena

I should have given more details - here is what I actually get when I
urn irb:

C:\chris>irb
stty: Unknown mode: g
stty: Unknown mode: icrnl
irb(main):001:0> quit
Usage: stty [-a|-all|everything]
stty [[-]sane|hide|line|echo|iproc|winput|minput|oproc|owrap]
[rows [#][,[#]]] [columns [#][,[#]]] ([icp #] [ocp #]|[cp
#]) [ pos [#][,[#]]] [erase c]

C:\chris>which stty
C:/PROGRA~1/MKSTOO~1/mksnt/stty.exe

This made me suspect some bad interaction with MKS Toolkit (a
commercial package providing unix tools for windows). So I try in a
shell that has my PATH adusted to remove the MKS stuff, and I get this
instead:

C:\chris>irb
C:/Ruby187/lib/ruby/site_ruby/1.8/rbreadline.rb:1796:in ``': No such
file or directory - infocmp -C (Errno::EN
OENT)
from C:/Ruby187/lib/ruby/site_ruby/1.8/rbreadline.rb:1796:in
`get_term_capabilities'
from C:/Ruby187/lib/ruby/site_ruby/1.8/rbreadline.rb:2005:in
`_rl_init_terminal_io'
from C:/Ruby187/lib/ruby/site_ruby/1.8/rbreadline.rb:2491:in
`readline_initialize_everything'
from C:/Ruby187/lib/ruby/site_ruby/1.8/rbreadline.rb:3726:in
`rl_initialize'
from C:/Ruby187/lib/ruby/site_ruby/1.8/rbreadline.rb:4720:in
`readline'
from C:/Ruby187/lib/ruby/site_ruby/1.8/readline.rb:40:in
`readline'
from C:/Ruby187/lib/ruby/1.8/irb/input-method.rb:97:in `gets'
from C:/Ruby187/lib/ruby/1.8/irb.rb:140:in `eval_input'
from C:/Ruby187/lib/ruby/1.8/irb.rb:271:in `signal_status'
from C:/Ruby187/lib/ruby/1.8/irb.rb:139:in `eval_input'
from C:/Ruby187/lib/ruby/1.8/irb/ruby-lex.rb:189:in `call'
from C:/Ruby187/lib/ruby/1.8/irb/ruby-lex.rb:189:in
`buf_input'
from C:/Ruby187/lib/ruby/1.8/irb/ruby-lex.rb:104:in `getc'
from C:/Ruby187/lib/ruby/1.8/irb/slex.rb:206:in `match_io'
from C:/Ruby187/lib/ruby/1.8/irb/slex.rb:76:in `match'
from C:/Ruby187/lib/ruby/1.8/irb/ruby-lex.rb:287:in `token'
from C:/Ruby187/lib/ruby/1.8/irb/ruby-lex.rb:263:in `lex'
from C:/Ruby187/lib/ruby/1.8/irb/ruby-lex.rb:234:in
`each_top_level_statement'
from C:/Ruby187/lib/ruby/1.8/irb/ruby-lex.rb:230:in `loop'
from C:/Ruby187/lib/ruby/1.8/irb/ruby-lex.rb:230:in
`each_top_level_statement'
from C:/Ruby187/lib/ruby/1.8/irb/ruby-lex.rb:229:in `catch'
from C:/Ruby187/lib/ruby/1.8/irb/ruby-lex.rb:229:in
`each_top_level_statement'
from C:/Ruby187/lib/ruby/1.8/irb.rb:154:in `eval_input'
from C:/Ruby187/lib/ruby/1.8/irb.rb:71:in `start'
from C:/Ruby187/lib/ruby/1.8/irb.rb:70:in `catch'
from C:/Ruby187/lib/ruby/1.8/irb.rb:70:in `start'
from C:/Ruby187/bin/irb:13

I don't know what infocmp is, but the first google hit is for
mkssoftware.com - very suspicious.

Any ideas what I should do? I'm guessing I should re-run the
installer in an environment that does not have the MKS tools in the
path. I'll let you know whether that helps.

Thank you,

Chris Perkins

Luis Lavena

unread,
Dec 3, 2010, 10:03:04 AM12/3/10
to rubyin...@googlegroups.com
On Fri, Dec 3, 2010 at 11:57 AM, Chris Perkins <chrispe...@gmail.com> wrote:
> I should have given more details - here is what I actually get when I
> urn irb:
>
> C:\chris>irb
> stty: Unknown mode: g
> stty: Unknown mode: icrnl
> irb(main):001:0> quit
> Usage:  stty [-a|-all|everything]
>        stty [[-]sane|hide|line|echo|iproc|winput|minput|oproc|owrap]
>             [rows [#][,[#]]] [columns [#][,[#]]] ([icp #] [ocp #]|[cp
> #]) [ pos [#][,[#]]] [erase c]
>
> C:\chris>which stty
> C:/PROGRA~1/MKSTOO~1/mksnt/stty.exe
>
> This made me suspect some bad interaction with MKS Toolkit (a
> commercial package providing unix tools for windows). So I try in a
> shell that has my PATH adusted to remove the MKS stuff, and I get this
> instead:
>

Please remove TERM environment variable and try again.

(SET TERM should tell you something like xterm or msys)

> Any ideas what I should do?  I'm guessing I should re-run the
> installer in an environment that does not have the MKS tools in the
> path. I'll let you know whether that helps.
>

The MKS Toolkit sets the environment variables to make things work
*for them*, borking others in the process.

Try that and let us know.

Chris Perkins

unread,
Dec 3, 2010, 10:25:17 AM12/3/10
to RubyInstaller
On Dec 3, 10:03 am, Luis Lavena <luislav...@gmail.com> wrote:
Yes, that works!

Unfortunately I need MKS for work (part of weird home-grown build
automation tool we use), otherwise I would just get rid of it
completely.

Thank you very much for your help, Luis.

Chris

Luis Lavena

unread,
Dec 3, 2010, 10:26:38 AM12/3/10
to rubyin...@googlegroups.com
On Fri, Dec 3, 2010 at 12:25 PM, Chris Perkins <chrispe...@gmail.com> wrote:
>
> Yes, that works!
>
> Unfortunately I need MKS for work (part of weird home-grown build
> automation tool we use), otherwise I would just get rid of it
> completely.
>

I don't believe the TERM variable is really needed, only if you're
using a weird terminal or something like vxrt, right?

If not, then remove the variable and profit form Ruby ;-)

Reply all
Reply to author
Forward
0 new messages