# Using the console in IronRuby on Rails

**URL:** <https://www.ruby-forum.com/t/using-the-console-in-ironruby-on-rails/178209>\
**Category:** IronRuby\
**Created:** [October 30, 2009, 8:07pm UTC](https://www.ruby-forum.com/t/using-the-console-in-ironruby-on-rails/178209 "2009-10-30T20:07:47Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![shayfriedman](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/bbe5ce/32.png) [@shayfriedman](https://www.ruby-forum.com/u/shayfriedman)\
**Post date:** [October 30, 2009, 8:07pm UTC](https://www.ruby-forum.com/t/using-the-console-in-ironruby-on-rails/178209/1 "2009-10-30T20:07:47Z")

</div>

Hi there,

I tried to use the Ruby on Rails console with IronRuby on an application  
I’m  
building by executing “ir script/console”. Doing so ended up with an  
exception from RubyProcess.CreateProcess.

I debugged and found out that RoR tries to execute irb.bat which is  
MRI’s,  
so I modified rails-2.3.3\lib\commands\console.rb to point to iirb.bat  
instead. That didn’t work as well.  
I continued and discovered that RubyProcess doesn’t consider bat files  
as  
executables. I don’t know if it’s on purpose but in order to fix the  
problem, I added the bat extension to the valid executable extension  
list  
and set the full path of iirb.bat in rails’ console.rb file.

Am I doing something wrong or is my little patch correct?

Thanks,  
Shay.

---

<div class="post-metadata">

**Author:** ![shayfriedman](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/bbe5ce/32.png) [@shayfriedman](https://www.ruby-forum.com/u/shayfriedman)\
**Post date:** [October 30, 2009, 8:14pm UTC](https://www.ruby-forum.com/t/using-the-console-in-ironruby-on-rails/178209/2 "2009-10-30T20:14:48Z")

</div>

You can add a RubySpec spec for it to see the details of the specific  
Ruby API. Then if MRI and IronRuby both have the same behavior for the  
spec, your patch would be correct. Ie. You can use TDD to figure out the  
right behavior.

From: removed\_email\_address@domain.invalid  
[[mailto:removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)] On Behalf Of Shay F.  
Sent: Friday, October 30, 2009 11:50 AM  
To: ironruby-core  
Subject: [Ironruby-core] Using the console in IronRuby on Rails

Hi there,

I tried to use the Ruby on Rails console with IronRuby on an application  
I’m building by executing “ir script/console”. Doing so ended up with an  
exception from RubyProcess.CreateProcess.

I debugged and found out that RoR tries to execute irb.bat which is  
MRI’s, so I modified rails-2.3.3\lib\commands\console.rb to point to  
iirb.bat instead. That didn’t work as well.  
I continued and discovered that RubyProcess doesn’t consider bat files  
as executables. I don’t know if it’s on purpose but in order to fix the  
problem, I added the bat extension to the valid executable extension  
list and set the full path of iirb.bat in rails’ console.rb file.

Am I doing something wrong or is my little patch correct?

Thanks,  
Shay.

–

---

<div class="post-metadata">

**Author:** ![shayfriedman](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/bbe5ce/32.png) [@shayfriedman](https://www.ruby-forum.com/u/shayfriedman)\
**Post date:** [October 30, 2009, 9:35pm UTC](https://www.ruby-forum.com/t/using-the-console-in-ironruby-on-rails/178209/3 "2009-10-30T21:35:01Z")

</div>

I would like to see if MRI uses PATHEXT in this case, but I think from  
talking with Tomas, that it doesn’t.

From: removed\_email\_address@domain.invalid  
[[mailto:removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)] On Behalf Of Shri B.  
Sent: Friday, October 30, 2009 12:14 PM  
To: removed\_email\_address@domain.invalid  
Subject: Re: [Ironruby-core] Using the console in IronRuby on Rails

You can add a RubySpec spec for it to see the details of the specific  
Ruby API. Then if MRI and IronRuby both have the same behavior for the  
spec, your patch would be correct. Ie. You can use TDD to figure out the  
right behavior.

From: removed\_email\_address@domain.invalid  
[[mailto:removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)] On Behalf Of Shay F.  
Sent: Friday, October 30, 2009 11:50 AM  
To: ironruby-core  
Subject: [Ironruby-core] Using the console in IronRuby on Rails

Hi there,

I tried to use the Ruby on Rails console with IronRuby on an application  
I’m building by executing “ir script/console”. Doing so ended up with an  
exception from RubyProcess.CreateProcess.

I debugged and found out that RoR tries to execute irb.bat which is  
MRI’s, so I modified rails-2.3.3\lib\commands\console.rb to point to  
iirb.bat instead. That didn’t work as well.  
I continued and discovered that RubyProcess doesn’t consider bat files  
as executables. I don’t know if it’s on purpose but in order to fix the  
problem, I added the bat extension to the valid executable extension  
list and set the full path of iirb.bat in rails’ console.rb file.

Am I doing something wrong or is my little patch correct?

Thanks,  
Shay.

–

---

<div class="post-metadata">

**Author:** ![shayfriedman](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/bbe5ce/32.png) [@shayfriedman](https://www.ruby-forum.com/u/shayfriedman)\
**Post date:** [October 30, 2009, 11:33pm UTC](https://www.ruby-forum.com/t/using-the-console-in-ironruby-on-rails/178209/4 "2009-10-30T23:33:18Z")

</div>

Thanks guys!

On Fri, Oct 30, 2009 at 10:22 PM, Jimmy S. \<

---

<div class="post-metadata">

**Author:** ![shayfriedman](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/bbe5ce/32.png) [@shayfriedman](https://www.ruby-forum.com/u/shayfriedman)\
**Post date:** [October 30, 2009, 9:35pm UTC](https://www.ruby-forum.com/t/using-the-console-in-ironruby-on-rails/178209/5 "2009-10-30T21:35:37Z")

</div>

Sorry, this is a patch I missed in the docs  
([http://ironruby.net/Documentation/Real\_Ruby\_Applications/Rails#console](http://ironruby.net/Documentation/Real_Ruby_Applications/Rails#console)).  
This behavior hasn’t changed in Rails, and I fixed it in the past  
without patch IronRuby, so I would suggest not patching IronRuby now to  
fix it. I’ll figure out what the exact patch to Rails was and post it to  
the documentation.

From: removed\_email\_address@domain.invalid  
[[mailto:removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)] On Behalf Of Jim D.  
Sent: Friday, October 30, 2009 12:57 PM  
To: removed\_email\_address@domain.invalid  
Subject: Re: [Ironruby-core] Using the console in IronRuby on Rails

I would like to see if MRI uses PATHEXT in this case, but I think from  
talking with Tomas, that it doesn’t.

From: removed\_email\_address@domain.invalid  
[[mailto:removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)] On Behalf Of Shri B.  
Sent: Friday, October 30, 2009 12:14 PM  
To: removed\_email\_address@domain.invalid  
Subject: Re: [Ironruby-core] Using the console in IronRuby on Rails

You can add a RubySpec spec for it to see the details of the specific  
Ruby API. Then if MRI and IronRuby both have the same behavior for the  
spec, your patch would be correct. Ie. You can use TDD to figure out the  
right behavior.

From: removed\_email\_address@domain.invalid  
[[mailto:removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)] On Behalf Of Shay F.  
Sent: Friday, October 30, 2009 11:50 AM  
To: ironruby-core  
Subject: [Ironruby-core] Using the console in IronRuby on Rails

Hi there,

I tried to use the Ruby on Rails console with IronRuby on an application  
I’m building by executing “ir script/console”. Doing so ended up with an  
exception from RubyProcess.CreateProcess.

I debugged and found out that RoR tries to execute irb.bat which is  
MRI’s, so I modified rails-2.3.3\lib\commands\console.rb to point to  
iirb.bat instead. That didn’t work as well.  
I continued and discovered that RubyProcess doesn’t consider bat files  
as executables. I don’t know if it’s on purpose but in order to fix the  
problem, I added the bat extension to the valid executable extension  
list and set the full path of iirb.bat in rails’ console.rb file.

Am I doing something wrong or is my little patch correct?

Thanks,  
Shay.

–
