JRuby (please use github issues at http://bugs.jruby.org)
  1. JRuby (please use github issues at http://bugs.jruby.org)
  2. JRUBY-4958

unable to run the system command (et al) in windows with an exe with spaces in it

    Details

    • Type: Bug Bug
    • Status: Reopened Reopened
    • Priority: Major Major
    • Resolution: Unresolved
    • Affects Version/s: None
    • Fix Version/s: None
    • Component/s: Windows
    • Labels:
      None
    • Environment:
      jruby 1.6.0.dev (ruby 1.8.7 patchlevel 249) (2010-07-13 23c2ef7) (Java HotSpot(TM) Client VM 1.6.0_18) [x86-java]
    • Testcase included:
      yes
    • Number of attachments :
      0

      Description

      MRI:

      >> system "C:/program files/VideoLan/VLC/vlc.exe silence.wav"
      => true

      I know it's ugly, but it's how MRI does things

      -r

        Activity

        Hide
        Roger Pack added a comment -

        Appears that it was never meant to be a spec that it behave this way.
        Re-open if you want to be "bug for bug compatible" with MRI <= 1.9.1

        -r

        Show
        Roger Pack added a comment - Appears that it was never meant to be a spec that it behave this way. Re-open if you want to be "bug for bug compatible" with MRI <= 1.9.1 -r
        Hide
        Roger Pack added a comment -

        appears there is some more work that could be done here.

        With MRI 1.9.2, the following works:

        >> IO.popen("'c:/program files/Internet Explorer/iexplore' about:blank").pid
        => 3548
        >> IO.popen("\"c:/program files/Internet Explorer/iexplore\" about:blank").pid
        => 3549

        et al

        (but not in jruby)

        A work around (for followers) is to CD into the right directory

        Dir.chdir("c:/program files/Internet Explorer") do; p Dir.pwd; IO.popen("iexplore about:blank"); end

        Show
        Roger Pack added a comment - appears there is some more work that could be done here. With MRI 1.9.2, the following works: >> IO.popen("'c:/program files/Internet Explorer/iexplore' about:blank").pid => 3548 >> IO.popen("\"c:/program files/Internet Explorer/iexplore\" about:blank").pid => 3549 et al (but not in jruby) A work around (for followers) is to CD into the right directory Dir.chdir("c:/program files/Internet Explorer") do; p Dir.pwd; IO.popen("iexplore about:blank"); end
        Hide
        Roger Pack added a comment -

        This is still unresolved (and is the case for popen, as well)

        {{

        { > IO.popen "\"c:\\Program Files (x86)\\videolan\\VLC\\vlc.exe\" c" Java::JavaLang::IllegalArgumentException: from java.lang.ProcessImpl.<init>(ProcessImpl.java:69) from java.lang.ProcessImpl.start(ProcessImpl.java:30) from java.lang.ProcessBuilder.start(ProcessBuilder.java:453) from java.lang.Runtime.exec(Runtime.java:593) from org.jruby.util.ShellLauncher.popenShared(ShellLauncher.java:612) from org.jruby.util.ShellLauncher.popenShared(ShellLauncher.java:591) from org.jruby.util.ShellLauncher.popenShared(ShellLauncher.java:587) from org.jruby.util.ShellLauncher.popen(ShellLauncher.java:571) from org.jruby.RubyIO.popen(RubyIO.java:3505) from org.jruby.RubyIO$s$0$1$popen.call(RubyIO$s$0$1$popen.gen:65535) from org.jruby.internal.runtime.methods.DynamicMethod.call(DynamicMethod.java:209) from org.jruby.internal.runtime.methods.DynamicMethod.call(DynamicMethod.java:205) from org.jruby.runtime.callsite.CachingCallSite.cacheAndCall(CachingCallSite.java:282) from org.jruby.runtime.callsite.CachingCallSite.call(CachingCallSite.java:139) from org.jruby.ast.CallOneArgNode.interpret(CallOneArgNode.java:57) from org.jruby.ast.NewlineNode.interpret(NewlineNode.java:103) ... 122 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 C_3a_.installs.jruby_minus_1_dot_6_dot_1_dot_64.bin.jirb.__file__(C:/installs/jruby-1.6.1.64/bin/jirb:13) from C_3a_.installs.jruby_minus_1_dot_6_dot_1_dot_64.bin.jirb.load(C:/installs/jruby-1.6.1.64/bin/jirb) from org.jruby.Ruby.runScript(Ruby.java:671) from org.jruby.Ruby.runNormally(Ruby.java:575) from org.jruby.Ruby.runFromMain(Ruby.java:424) 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):005:0> }

        }}

        Apparently if you surround the exe path with quotes, it should work (as a spec), and if you don't, it's implementation specific.

        Show
        Roger Pack added a comment - This is still unresolved (and is the case for popen, as well) {{ { > IO.popen "\"c:\\Program Files (x86)\\videolan\\VLC\\vlc.exe\" c" Java::JavaLang::IllegalArgumentException: from java.lang.ProcessImpl.<init>(ProcessImpl.java:69) from java.lang.ProcessImpl.start(ProcessImpl.java:30) from java.lang.ProcessBuilder.start(ProcessBuilder.java:453) from java.lang.Runtime.exec(Runtime.java:593) from org.jruby.util.ShellLauncher.popenShared(ShellLauncher.java:612) from org.jruby.util.ShellLauncher.popenShared(ShellLauncher.java:591) from org.jruby.util.ShellLauncher.popenShared(ShellLauncher.java:587) from org.jruby.util.ShellLauncher.popen(ShellLauncher.java:571) from org.jruby.RubyIO.popen(RubyIO.java:3505) from org.jruby.RubyIO$s$0$1$popen.call(RubyIO$s$0$1$popen.gen:65535) from org.jruby.internal.runtime.methods.DynamicMethod.call(DynamicMethod.java:209) from org.jruby.internal.runtime.methods.DynamicMethod.call(DynamicMethod.java:205) from org.jruby.runtime.callsite.CachingCallSite.cacheAndCall(CachingCallSite.java:282) from org.jruby.runtime.callsite.CachingCallSite.call(CachingCallSite.java:139) from org.jruby.ast.CallOneArgNode.interpret(CallOneArgNode.java:57) from org.jruby.ast.NewlineNode.interpret(NewlineNode.java:103) ... 122 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 C_3a_.installs.jruby_minus_1_dot_6_dot_1_dot_64.bin.jirb.__file__(C:/installs/jruby-1.6.1.64/bin/jirb:13) from C_3a_.installs.jruby_minus_1_dot_6_dot_1_dot_64.bin.jirb.load(C:/installs/jruby-1.6.1.64/bin/jirb) from org.jruby.Ruby.runScript(Ruby.java:671) from org.jruby.Ruby.runNormally(Ruby.java:575) from org.jruby.Ruby.runFromMain(Ruby.java:424) 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):005:0> } }} Apparently if you surround the exe path with quotes, it should work (as a spec), and if you don't, it's implementation specific.
        Hide
        Roger Pack added a comment -
        Show
        Roger Pack added a comment - related: http://jira.codehaus.org/browse/JRUBY-1315

          People

          • Assignee:
            Thomas E Enebo
            Reporter:
            Roger Pack
          • Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

            • Created:
              Updated: