On Tue, 30 Apr 2024 15:02:21 GMT, Jan Lahoda <jlah...@openjdk.org> wrote:
>> Consider code like: >> >> public class ConsoleTest { >> public static void main(String... args) { >> System.console().printf("Hello!"); >> } >> } >> >> >> When run as: >> >> $ java ConsoleTest.java >/dev/null >> >> >> it prints `Hello!` to stderr, instead of to stdout (where it would be >> redirected). >> >> The proposed fix is to simply force the use of stdout. Sadly, this cannot be >> done solely using JLine configuration, we actually need to change the >> JLine's code for that. >> >> The most tricky part is a test. There are two sub-tests, one effectively >> testing a case where all of stdin/out/err are redirected, the other is >> attempting to test the case where stdin is attached to a terminal, while >> stdout is redirected. The second sub-test using a native functions to create >> a pty and to attach to it, and should run in a separate VM, as it leaves the >> VM attached to the terminal. > > Jan Lahoda has updated the pull request incrementally with one additional > commit since the last revision: > > Adjusting test, as suggested. Looks good! ------------- Marked as reviewed by naoto (Reviewer). PR Review: https://git.openjdk.org/jdk/pull/18996#pullrequestreview-2034202479