| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
The System.console() method is intended to indicate whether the JVM process is running with stdio connected to a TTY-like, but in JDK 22 through 24, it also returns non-null for non-TTY stdio due to the use of JLine as a pseudo-terminal. This behavior changed back to JDK 21 behavior in JDK 25, but we must continue double- checking Console.isTerminal() for situations where the JLine logic is live. Part of improvements for jruby#9590. See https://bugs.openjdk.org/browse/JDK-8361911 for an OpenJDK issue that details the changing behavior of System.console().
We have other reasons to know if JRuby was started as the JVM's main entry point, so rename this to reflect the actual state.
|
See also #8934 for previous attempts to deal with JDK 22 always returning non-null System.console(). |
Sorry, something went wrong.
If JRuby is started through Main, then the stdio channels we set up are either native or come from the JVM's System.in/out/err. In the latter case, we can use the JVM's System.console() and Console.isTerminal() methods to indicate if the JRuby stdio is a TTY. This fixes previous logic that always assumed any non-native stdio was conneected to a TTY, leading to cases where embedded use might incorrectly assume that color console output or hard process exits were appropriate. Fixes jruby#9590
| Back | FazBrowse Home | New Git URL |
This introduces some cleanup and improvements in how we determine whether an IO is a TTY (IO#tty? method):
This should address situations where JRuby has been embedded as part of a larger application with user-facing stdio streams connected to non-terminal channels, such as in #9590 (deployed in Tomcat using jruby-rack).
Draft until appropriate tests can be added.