This Bugzilla instance is a read-only archive of historic NetBeans bug reports. To report a bug in NetBeans please follow the project's instructions for reporting issues.

Bug 133066 - Rails Console does not work in Windows using MRI.
Summary: Rails Console does not work in Windows using MRI.
Status: RESOLVED FIXED
Alias: None
Product: ruby
Classification: Unclassified
Component: Rails (show other bugs)
Version: 6.x
Hardware: Other Windows XP
: P3 blocker (vote)
Assignee: Erno Mononen
URL:
Keywords:
: 139808 (view as bug list)
Depends on:
Blocks:
 
Reported: 2008-04-17 01:26 UTC by bruparel
Modified: 2008-07-14 10:59 UTC (History)
0 users

See Also:
Issue Type: DEFECT
Exception Reporter:


Attachments
patch (2.45 KB, text/plain)
2008-06-09 09:33 UTC, Erno Mononen
Details

Note You need to log in before you can comment on or make changes to this bug.
Comment 1 Erno Mononen 2008-04-23 11:12:27 UTC
Thanks for filing this. Could you please try whether 

script/console --irb='irb --noreadline' 

using the command line works for you? 
Comment 2 bruparel 2008-04-23 14:02:10 UTC
Emonomem,
You may be on to something.  Here are the results of starting the console:

C:\InstantRails20\rails_apps\blog>ruby script/console --irb='irb --noreadline'
Loading development environment (Rails 2.0.2)
C:/InstantRails20/ruby/lib/ruby/gems/1.8/gems/rails-2.0.2/lib/commands/console.rb:32:in `exec': Exec format error - 
irb --noreadline  -r irb/co
mpletion -r "C:/InstantRails20/rails_apps/blog/config/environment" -r console_app -r console_with_helpers --simple-
prompt (Errno::ENOEXEC)
        from C:/InstantRails20/ruby/lib/ruby/gems/1.8/gems/rails-2.0.2/lib/commands/console.rb:32
        from C:/InstantRails20/ruby/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:27:in `gem_original_require'
        from C:/InstantRails20/ruby/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:27:in `require'
        from script/console:3

C:\InstantRails20\rails_apps\blog>ruby script/console
Loading development environment (Rails 2.0.2)
>>

Note that when I start it without the irb command line parameters that you provided, it works fine so the readline 
support is a problem?
Comment 3 Erno Mononen 2008-04-29 08:50:09 UTC
Yes, looks like the readline support could be the problem (unless the argument formatting should be different on 
Windows, e.g. it should be without the single quotes or something similar). The readline arg was added to fix issue 
130264, looks like there needs to be a check for what platform is used. 

PS. Sorry for the slow progress on this, I haven't got around to install Windows yet.
Comment 4 vits 2008-05-26 12:17:22 UTC
I can confirm, that issue is irb part --irb='irb --readline' option. See rails/lib/commands/console.rb - RUBY_PLATFORM
is checked at the beginning (and 'irb.bat' selected under Windows), then options are parsed and 'irb.bat' gets replaced
by 'irb --readline'. So, YES, you should check platform and pass 'irb --readline' or 'irb.bat --readline' accordingly.

My temporary fix was to patch rails/lib/commands.console.rb itself:

--- console.rb.old	2008-05-26 14:12:00.000000000 +0300
+++ console.rb	2008-05-26 14:12:00.000000000 +0300
@@ -8,6 +8,7 @@
   opt.on("--irb=[#{irb}]", 'Invoke a different irb.') { |v| options[:irb] = v }
   opt.parse!(ARGV)
 end
+options[:irb] = options[:irb].gsub(/^irb\s/, 'irb.bat ')
 
 libs =  " -r irb/completion"
 libs << %( -r "#{RAILS_ROOT}/config/environment")
Comment 5 Erno Mononen 2008-06-09 09:33:13 UTC
Created attachment 62540 [details]
patch
Comment 6 Erno Mononen 2008-06-09 09:37:25 UTC
Thanks vits for that info, very helpful. I attached a patch for this in case anybody who is using Windows and building 
from sources would like to give it a try. In any case I'll test it myself too before M1. 
Comment 7 Erno Mononen 2008-06-20 14:02:03 UTC
Fixed, the final patch is a bit different than the attached one. Changeset #1365b293fe8e.
.
Comment 8 Quality Engineering 2008-06-21 03:58:37 UTC
Integrated into 'main-golden', available in NB_Trunk_Production #272 build
Changeset: http://hg.netbeans.org/main/rev/1365b293fe8e
User: Erno Mononen <emononen@netbeans.org>
Log: #133066: Rails Console does not work in Windows using MRI.
Comment 9 Erno Mononen 2008-07-14 10:59:43 UTC
*** Issue 139808 has been marked as a duplicate of this issue. ***