Join GitHub today
GitHub is home to over 28 million developers working together to host and review code, manage projects, and build software together.Sign up
Process.spawn with redirect causes ConcurrencyError #3038
jruby 184.108.40.206.rc1 (2.2.2) 2015-06-10 a0bf3b3 Java HotSpot(TM) 64-Bit Server VM 25.45-b02 on 1.8.0_45-b14 +jit [darwin-x86_64]
It seems JRuby does not like redirecting output on Process.spawn:
The :out key's array can have 1, 2, or 3 values in it. This ConcurrencyError is actually thrown because of an ArrayIndexOutOfBoundsException thrown at https://github.com/jruby/jruby/blob/master/core/src/main/java/org/jruby/RubyArray.java#L4398. That gets called via https://github.com/jruby/jruby/blob/master/core/src/main/java/org/jruby/util/io/PopenExecutor.java#L1537. It looks like the code here and on line 1528 of PopenExecutor assumes that requesting an array index past the end of the array will return nil. But, what's happening instead is this ConcurrencyError gets thrown.
The code needs to either check array length before accessing elements or use another method besides