Skip to content

Open3 doesn't write on the right STDOUT #8237

@n-rodriguez

Description

@n-rodriguez

Hi there!

It seems that there is an issue with Open3 and JRuby :

#!/usr/bin/env ruby

require "open3"

def capture3_args_for(cmd, dir)
  ["git", *cmd]
end

cmd = 'version'
dir = nil

puts *capture3_args_for(cmd, dir).inspect
out, err, status = Open3.capture3(*capture3_args_for(cmd, dir))

puts "@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@"
puts "out.inspect: #{out.inspect}"
puts "err.inspect: #{err.inspect}"
puts "status.inspect: #{status.inspect}"
puts "@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@"

With Ruby 3.3.1 :

nicolas@MacBook-Pro-de-Nicolas:~/PROJECTS/CONCERTO/concerto$ ./toto.rb
["git", "version"]
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
out.inspect: "git version 2.45.0\n" # GOOD
err.inspect: ""
status.inspect: #<Process::Status: pid 13555 exit 0>
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@

With JRuby 9.4.7.0 :

nicolas@MacBook-Pro-de-Nicolas:~/PROJECTS/CONCERTO/concerto$ ./toto.rb
["git", "version"]
git version 2.45.0 # BAD
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
out.inspect: "" # BAD
err.inspect: ""
status.inspect: #<Process::Status: pid 13749 exit 0>
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@

Extracted from : ruby/rubygems#7651

Thank you!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions