Skip to content

jruby error on init; error on IO.popen(); fails when cmd is string, works when cmd is array #10

Description

@bwalsh

note brackets around cmd []
cmd is a string or an array as follows.

      @engine = IO.popen([cmd],"w+")

environment

java -version
java version "1.7.0_09"
Java(TM) SE Runtime Environment (build 1.7.0_09-b05)
Java HotSpot(TM) 64-Bit Server VM (build 23.5-b02, mixed mode)

jruby -v
jruby 1.7.2 (1.9.3p327) 2013-01-04 302c706 on Java HotSpot(TM) 64-Bit Server VM 1.7.0_09-b05 [Windows 7-amd64]

trace

I've added a few puts() statements to trace ...

  puts "R cmd #{cmd}"
     begin
       @engine = IO.popen(cmd,"w+")
     rescue Exception => e  
        puts "e.message=#{e.message}"
        puts e.backtrace
        puts e.inspect  
        raise e.message
     end  
  puts "R @engine #{@engine}"

with the brackets ...

jruby -S irb
irb(main):001:0> require "rinruby"
R start
R require java
R platform windows-java
R executable "C:/Program Files/R/R-2.15.2/bin/i386/Rterm.exe"
R loaded readline
R cmd "C:/Program Files/R/R-2.15.2/bin/i386/Rterm.exe" --ess --slave
R @engine #IO:0x51a4f310

without the brackets ...

jruby -S irb
irb(main):001:0> require "rinruby"
R start
R require java
R platform windows-java
R executable "C:/Program Files/R/R-2.15.2/bin/i386/Rterm.exe"
R loaded readline
R cmd "C:/Program Files/R/R-2.15.2/bin/i386/Rterm.exe" --ess --slave
e.message=
java.lang.ProcessImpl.(ProcessImpl.java:181)
java.lang.ProcessImpl.start(ProcessImpl.java:133)
java.lang.ProcessBuilder.start(ProcessBuilder.java:1021)
jnr.posix.util.Java5ProcessMaker.start(Java5ProcessMaker.java:139)
org.jruby.util.ShellLauncher.buildProcess(ShellLauncher.java:492)
org.jruby.util.ShellLauncher.popenShared(ShellLauncher.java:734)
org.jruby.util.ShellLauncher.popen(ShellLauncher.java:693)
org.jruby.RubyIO.popen19(RubyIO.java:3931)
org.jruby.RubyIO$INVOKER$s$0$2$popen19.call(RubyIO$INVOKER$s$0$2$popen19.gen)
org.jruby.internal.runtime.methods.DynamicMethod.call(DynamicMethod.java:216)
org.jruby.internal.runtime.methods.DynamicMethod.call(DynamicMethod.java:212)
org.jruby.runtime.callsite.CachingCallSite.cacheAndCall(CachingCallSite.java:346)
org.jruby.runtime.callsite.CachingCallSite.call(CachingCallSite.java:204)
c_3a_.Users.bwalsh.jruby_minus_1_dot_7_dot_2.lib.ruby.gems.shared.gems.rinruby_minus_2_dot_0_dot_3.lib.rinruby.chained_6_rescue_4$RUBY$SYNTHETICinitialize(c:/Users/bwalsh/jruby-1.7.2/lib/ruby/gems/shared/gems/rinruby-2.0.3/lib/rinruby.rb:173)

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions