[prev in list] [next in list] [prev in thread] [next in thread]
List: openjdk-core-libs-dev
Subject: Re: RFR: 8330998: System.console() writes to stderr when stdout is redirected [v3]
From: Jan Lahoda <jlahoda () openjdk ! org>
Date: 2024-04-30 15:02:21
Message-ID: bJ99HAH1H96JfGviZb0bcGd5sKqTd0Pe06mgRxcG4Cc=.f1e8001f-1302-4385-be67-7686609ffa61 () github ! com
[Download RAW message or body]
> 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.
-------------
Changes:
- all: https://git.openjdk.org/jdk/pull/18996/files
- new: https://git.openjdk.org/jdk/pull/18996/files/8a918e3f..76599ac9
Webrevs:
- full: https://webrevs.openjdk.org/?repo=jdk&pr=18996&range=02
- incr: https://webrevs.openjdk.org/?repo=jdk&pr=18996&range=01-02
Stats: 57 lines in 1 file changed: 6 ins; 35 del; 16 mod
Patch: https://git.openjdk.org/jdk/pull/18996.diff
Fetch: git fetch https://git.openjdk.org/jdk.git pull/18996/head:pull/18996
PR: https://git.openjdk.org/jdk/pull/18996
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic