Why, when I run ruby.exe / IRB, all I get is an empty DOS shell?
I have installed ruby ββ1.9.1p243 (2009-07-16 version 24175) [i386-mingw32] on my Windows XP laptop.
When I run ruby.exe, I get a blank DOS shell window. There is no expected "irb (main): 001: 0>" at the top left of the command line. I can type into the shell, but whatever code I type actually does anything when I hit enter.
I should mention that I can run IRB from CMOS shell cmd.exe and it works great. Also, I have the system variables path set to c: \ ruby ββ\ bin, so I know everything is fine.
Any ideas what might be wrong and how to fix this?
More precisely, launching ruby
by itself still gives you a ruby ββinterpreter, but you miss out on these IRB functions: interactive prompt with line editing, immediate execution, and automatic printing of the result.
For example:
C:\> ruby
puts "hello"
"test string"
Click Ctrl+Zand then Enter. It outputs
hello
Ctrl + Z sends an end-of-file signal to the interpreter. Unlike IRB, it does not consume one line at a time by default, so it was expecting a "hello" output. The "test string" was not displayed at all.
PS Conversely, you can also pass the filename to the IRB (simple irb hello.rb
) and it will run it as if you had typed it, specifying each line of code and the result as it goes.
source to share