-
Notifications
You must be signed in to change notification settings - Fork 914
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
Open3 doesn't write on the right STDOUT #8237
Comments
I saw that you're on JDK 21 from the rubygems thread. Can you please try JDK 17 instead? There is a known bug in JDK 21 that's affecting subprocess stdio for JRuby in many different ways: #8069 |
Hi there! Thanks for your answer! It doesn't work neither with JDK17 : #!/usr/bin/env ruby
require "open3"
require 'java'
java_import java.lang.System
def capture3_args_for(cmd, dir)
["git", *cmd]
end
cmd = 'version'
dir = nil
puts %x(java --version)
puts System.getProperties["java.runtime.version"]
puts JRUBY_VERSION
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 "@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@" nicolas@MacBook-Pro-de-Nicolas:~/PROJECTS/CONCERTO/concerto$ ./foo.rb
openjdk 17.0.11 2024-04-16
OpenJDK Runtime Environment Homebrew (build 17.0.11+0)
OpenJDK 64-Bit Server VM Homebrew (build 17.0.11+0, mixed mode, sharing)
17.0.11+0
9.4.7.0
["git", "version"]
git version 2.45.1
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
out.inspect: ""
err.inspect: ""
status.inspect: #<Process::Status: pid 39796 exit 0>
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ |
Strangely it works with TruffleRuby : nicolas@MacBook-Pro-de-Nicolas:~/PROJECTS/CONCERTO/concerto$ ./foo.rb
setrlimit to increase file descriptor limit failed, errno 22
openjdk 17.0.11 2024-04-16
OpenJDK Runtime Environment Homebrew (build 17.0.11+0)
OpenJDK 64-Bit Server VM Homebrew (build 17.0.11+0, mixed mode, sharing)
3.2.2
["git", "version"]
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
out.inspect: "git version 2.45.1\n"
err.inspect: ""
status.inspect: #<Process::Status: pid 40111 exit 0>
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ |
Okay, it's probably a bug in our version of open3. |
I tested the following:
|
Looks like this is an issue with Homebrew JDK... |
Ok I really did not expect that! Of the linked libraries, libSystem seems like the most likely candidate but I have no idea what could cause such a visible change. I think a next step would be to build the same version manually on MacOS and test it. It seems less likely to be something JRuby is doing wrong but we will keep this open until we have an explanation. |
If a hand-build version of the homebrew sources works ok, I think we would want to file a bug with them. There may have been a problem introduced when their build was created. |
This has to do with how
|
I confirm : nicolas@MacBook-Pro-de-Nicolas:~/PROJECTS/CONCERTO/concerto$ echo $JAVA_HOME
/opt/homebrew/opt/openjdk@17
nicolas@MacBook-Pro-de-Nicolas:~/PROJECTS/CONCERTO/concerto$ export JAVA_HOME=/opt/homebrew/opt/openjdk@17/libexec/openjdk.jdk/Contents/Home
nicolas@MacBook-Pro-de-Nicolas:~/PROJECTS/CONCERTO/concerto$ jruby foo.rb
openjdk 17.0.11 2024-04-16
OpenJDK Runtime Environment Homebrew (build 17.0.11+0)
OpenJDK 64-Bit Server VM Homebrew (build 17.0.11+0, mixed mode, sharing)
17.0.11+0
9.4.7.0
["git", "version"]
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
out.inspect: "git version 2.45.1\n"
err.inspect: ""
status.inspect: #<Process::Status: pid 14828 exit 0>
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ |
Could one of you paste the output of |
Oh I see there is a PR to fix this now! |
@headius The issue is that in homebrew they created symlinks for java binaries in order to have executables available at the path/to/Cellar/bin. For example:
If the user incorrectly set the $JAVA_HOME, the $JAVACMD is set to the symlink that can start Jruby, but it does not work properly. I’ve sent a PR to handle this kind of case where user passes an incorrect |
@ntkme Thank you! |
Hi there!
It seems that there is an issue with
Open3
and JRuby :With Ruby 3.3.1 :
With JRuby 9.4.7.0 :
Extracted from : rubygems/rubygems#7651
Thank you!
The text was updated successfully, but these errors were encountered: