Behavior of 'system'. Jruby 1.5.3

Hi All,

When I run the command:

jruby -e "system '/usr/bin/ruby -v'"

the version output I see is from JRuby, rather that the Ruby that I
expected. I suspect that this is related to some optimization used to
avoid
launching new JVM’s, or to make “Ruby” code work with “JRuby.”

My question is, “How do I turn this off?” I actually, really, want to
run
/usr/bin/ruby, and I’ve expressed that as clearly as I know how in the
code. My current hack is to write a little shell script (without ‘ruby’
in
its filename!) and route the call through that, but that is really
awkward.
Can I make JRuby run the actual command I tell it to?

Cheers,
–Bob

See if system ‘/usr/bin/env ruby -v’ works. That might confound the
jruby heuristics, and run the real ruby. Or you could try ‘/bin/sh
-c’ instead of /usr/bin/env.

On 7 October 2010 09:05, Bob W. [email protected] wrote:

My question is, “How do I turn this off?” I actually, really, want to run
/usr/bin/ruby, and I’ve expressed that as clearly as I know how in the
code. My current hack is to write a little shell script (without ‘ruby’ in
its filename!) and route the call through that, but that is really awkward.
Can I make JRuby run the actual command I tell it to?

Cheers,
–Bob


To unsubscribe from this list, please visit:

http://xircles.codehaus.org/manage_email

I believe this is a known issue: see http://bugs.jruby.org/5110

On Oct 6, 2010, at 8:11 PM, Wayne M. wrote:

jruby -e "system '/usr/bin/ruby -v'"

To unsubscribe from this list, please visit:

http://xircles.codehaus.org/manage_email

Bob W. wrote:

Hi All,

When I run the command:

jruby -e "system '/usr/bin/ruby -v'"

the version output I see is from JRuby, rather that the Ruby that I
expected. I suspect that this is related to some optimization used to
avoid
launching new JVM’s, or to make “Ruby” code work with “JRuby.”

Perhaps related to:

http://www.ruby-forum.com/topic/204508

?

(+1 for wishing the default of inproc were false–it’s quite surprising
when you run into these bugs…)

Oh, Thanks, Wayne! That worked!

Thanks, also, to Hirotsugu, but that appears to be a different issue.
My
“system” command ran fine, it just ran teh wrong program.

Cheers,
–Bob

Oh, thanks, Roger. That is, indeed related. Further more, reading over
there, I learned about

jruby.launch.inproc=true

I did not know about this setting. I will now go play with it!

And, yes. This was an expensive-in-time learning experience. I
understand
why it was done, but still…

Cheers,
–Bob

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