New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Closed
vassilios opened this Issue Jan 29, 2016 · 1 comment

Comments

Projects
None yet
2 participants
@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]

@headius

This comment has been minimized.

Show comment
Hide comment
@headius

headius Mar 4, 2016

Member

It appeared to work ok for me on 9.1:

$ jruby -e "Process.spawn('ls -al',:err => :out)"
total 490264
drwxr-xr-x   61 headius  staff       2074 Mar  4 11:57 .
drwxr-xr-x  144 headius  staff       4896 Feb 25 15:18 ..
drwxr-xr-x   18 headius  staff        612 Mar  4 12:06 .git

If it's still broken for you with a 9.1 snapshot from http://ci.jruby.org, reopen this issue.

Member

headius commented Mar 4, 2016

It appeared to work ok for me on 9.1:

$ jruby -e "Process.spawn('ls -al',:err => :out)"
total 490264
drwxr-xr-x   61 headius  staff       2074 Mar  4 11:57 .
drwxr-xr-x  144 headius  staff       4896 Feb 25 15:18 ..
drwxr-xr-x   18 headius  staff        612 Mar  4 12:06 .git

If it's still broken for you with a 9.1 snapshot from http://ci.jruby.org, reopen this issue.

@headius headius closed this Mar 4, 2016

@headius headius added this to the JRuby 9.1.0.0 milestone Mar 4, 2016

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