Skip to content

Process#spawn error when redirecting error to stdout (jruby 9.0.4.0) #3627

@vassilios

Description

@vassilios

Redirecting stderr to stdout in spawn gives an exception.

$ jirb
irb(main):001:0> Process.spawn('ls -al',:err => :out)
Java::JavaLang::ArrayIndexOutOfBoundsException: -2
from org.jruby.util.io.PopenExecutor.run_exec_dup2(PopenExecutor.java:789)
from org.jruby.util.io.PopenExecutor.execargRunOptions(PopenExecutor.java:986)
from org.jruby.util.io.PopenExecutor.spawnProcess(PopenExecutor.java:113)
from org.jruby.util.io.PopenExecutor.spawn(PopenExecutor.java:75)
from org.jruby.RubyProcess.spawn(RubyProcess.java:1296)
from             

Same thing happens if you use STDERR => STDOUT or 2 => 1 (instead of :err => :out) as shown in http://ruby-doc.org/core-2.2.2/Process.html#method-c-spawn

This was run on:
$ jruby -v
jruby 9.0.4.0 (2.2.2) 2015-11-12 b9fb7aa OpenJDK 64-Bit Server VM 24.91-b01 on 1.7.0_91-b02 +jit [linux-amd64]

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions