Skip to content
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
Closed

Comments

@vassilios
Copy link

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
Copy link
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 as completed 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
Projects
None yet
Development

No branches or pull requests

2 participants