JRuby

Open3.popen3 fails under --1.9 mode

Details

  • Type: Bug Bug
  • Status: Closed Closed
  • Priority: Major Major
  • Resolution: Fixed
  • Affects Version/s: JRuby 1.6
  • Fix Version/s: JRuby 1.6.1
  • Component/s: None
  • Labels:
    None
  • Number of attachments :
    0

Description

$ jruby -S irb
irb(main):001:0> require 'open3'; Open3.popen3( '/bin/ls' )
=> [#<IO:0x68acbd3a>, #<IO:0x24bb6086>, #<IO:0x9be1041>]
irb(main):002:0> exit
 
$ jruby --1.9 -S irb
irb(main):001:0> require 'open3'; Open3.popen3( '/bin/ls' )
ls: {:in=>#<IO:0x78871e65>, :out=>#<IO:0x6edcb6b4>, :err=>#<IO:0x5c5f1c48>}: No such file or directory
Java::JavaLang::RuntimeException: CallBlock does not have a static scope; this should not be called
	from org.jruby.runtime.CallBlock.getStaticScope(CallBlock.java:107)
	from org.jruby.RubyProc.setup(RubyProc.java:160)
	from org.jruby.RubyProc.newProc(RubyProc.java:117)
	from org.jruby.RubyProc.newProc(RubyProc.java:112)
	from org.jruby.Ruby.newProc(Ruby.java:2859)
	from org.jruby.internal.runtime.RubyRunnable.<init>(RubyRunnable.java:60)
	from org.jruby.RubyThread.initialize(RubyThread.java:269)
	from org.jruby.RubyThread$i$0$0$initialize.call(RubyThread$i$0$0$initialize.gen:65535)
	from org.jruby.RubyClass.finvoke(RubyClass.java:543)
	from org.jruby.javasupport.util.RuntimeHelpers.invoke(RuntimeHelpers.java:537)
	from org.jruby.RubyObject.callInit(RubyObject.java:226)
	from org.jruby.RubyThread.startThread(RubyThread.java:313)
	from org.jruby.RubyThread.newInstance(RubyThread.java:230)
	from org.jruby.RubyProcess.detach(RubyProcess.java:910)
	from org.jruby.RubyProcess$s$1$0$detach.call(RubyProcess$s$1$0$detach.gen:65535)
	from org.jruby.runtime.callsite.CachingCallSite.cacheAndCall(CachingCallSite.java:282)
... 153 levels...
	from org.jruby.ast.BlockNode.interpret(BlockNode.java:71)
	from org.jruby.evaluator.ASTInterpreter.INTERPRET_METHOD(ASTInterpreter.java:74)
	from org.jruby.internal.runtime.methods.InterpretedMethod.call(InterpretedMethod.java:190)
	from org.jruby.internal.runtime.methods.DefaultMethod.call(DefaultMethod.java:179)
	from org.jruby.runtime.callsite.CachingCallSite.cacheAndCall(CachingCallSite.java:282)
	from org.jruby.runtime.callsite.CachingCallSite.call(CachingCallSite.java:139)
	from Users.tobias.work.torquebox_minus_current.jruby.bin.jirb.__file__(/Users/tobias/work/torquebox-current/jruby/bin/jirb:13)
	from Users.tobias.work.torquebox_minus_current.jruby.bin.jirb.load(/Users/tobias/work/torquebox-current/jruby/bin/jirb)
	from org.jruby.Ruby.runScript(Ruby.java:670)
	from org.jruby.Ruby.runNormally(Ruby.java:574)
	from org.jruby.Ruby.runFromMain(Ruby.java:423)
	from org.jruby.Main.doRunFromMain(Main.java:278)
	from org.jruby.Main.internalRun(Main.java:198)
	from org.jruby.Main.run(Main.java:164)
	from org.jruby.Main.run(Main.java:148)
	from org.jruby.Main.main(Main.java:128)irb(main):002:0> exit

$ jruby --version
jruby 1.6.0 (ruby 1.8.7 patchlevel 330) (2011-03-15 f3b6154) (Java HotSpot(TM) 64-Bit Server VM 1.6.0_24) [darwin-x86_64-java]

Activity

Hide
Tobias Crawley added a comment -

IO.popen3 works fine:

$ jruby --1.9 -S irb
irb(main):001:0> IO.popen3('/bin/ls')
=> [#<IO:0x54cee271>, #<IO:0x5a749436>, #<IO:0x1bae939f>]
irb(main):002:0> exit

Is open3.rb not recommended for use w/JRuby?

Show
Tobias Crawley added a comment - IO.popen3 works fine:
$ jruby --1.9 -S irb
irb(main):001:0> IO.popen3('/bin/ls')
=> [#<IO:0x54cee271>, #<IO:0x5a749436>, #<IO:0x1bae939f>]
irb(main):002:0> exit
Is open3.rb not recommended for use w/JRuby?
Hide
Charles Oliver Nutter added a comment -

I've made a temporary fix for this for 1.6.1, but open3.rb needs to be reworked for JRuby. It uses spawn and other features in ways that we may not have implemented yet. It does not appear to use fork/exec anymore, which means we could support it more directly without core hacks like IO.popen3.

I will open a separate bug for open3.rb issues.

commit 2b768e0589eda44dbdb26cc097dc828130d84dad
Author: Charles Oliver Nutter <headius@headius.com>
Date: Sat Apr 9 15:51:23 2011 -0500

Fix JRUBY-5705: Open3.popen3 fails under --1.9 mode

  • Temporary hack for just Open3.popen3 to use 1.8 logic. open3.rb needs to be reworked for JRuby.
Show
Charles Oliver Nutter added a comment - I've made a temporary fix for this for 1.6.1, but open3.rb needs to be reworked for JRuby. It uses spawn and other features in ways that we may not have implemented yet. It does not appear to use fork/exec anymore, which means we could support it more directly without core hacks like IO.popen3. I will open a separate bug for open3.rb issues. commit 2b768e0589eda44dbdb26cc097dc828130d84dad Author: Charles Oliver Nutter <headius@headius.com> Date: Sat Apr 9 15:51:23 2011 -0500 Fix JRUBY-5705: Open3.popen3 fails under --1.9 mode
  • Temporary hack for just Open3.popen3 to use 1.8 logic. open3.rb needs to be reworked for JRuby.

People

Vote (0)
Watch (0)

Dates

  • Created:
    Updated:
    Resolved: