Summary
When using Open3#capture2 in Jruby in tests run through Travis, stdout is not captured and is instead printed to the log. This happens for all of the Open3 methods: catpure2, capture3, and open2/3. However, running a system command using backticks correctly captures output.
Travis environment:
- dist: xenial
- rvm:
- jruby-9.1 (uses 9.1.17)
- jruby-9.2 (uses 9.2.5.0)
Example build with the issue: https://travis-ci.org/github/aws/aws-sdk-ruby/jobs/700939400
Test code:
raw_out, process_status = Open3.capture2('echo "Hello"')
puts "cap2: #{raw_out}" # hello is printed directly to the logs. raw_out is empty"
raw_out, process_status = Open3.capture2e('echo "Hello"')
puts "cap2e: #{raw_out}" # hello is printed directly to the logs. raw_out is empty"
raw_out, process_status = Open3.capture2e('echo "Hello"', binmode: true)
puts "cap2e, binmode: #{raw_out}" # nothing printed to the logs. raw_out is empty"
raw_out = `echo "Hello"`
puts "backticks: #{raw_out}" # nothing printed in logs. raw_out is set to hello