Re: RFR: 8330998: System.console() writes to stderr when stdout is redirected [v2]

2024-05-01 Thread Jan Lahoda
On Mon, 29 Apr 2024 18:41:44 GMT, Naoto Sato wrote: > Looks good to me. Left some minor suggestions. BTW, should we file an issue > at the `JLine` project, not to redirect to stderr, or suggest a new config > (sorry if it has already been taken care of)? The code to choose the output stream

Re: RFR: 8330998: System.console() writes to stderr when stdout is redirected [v2]

2024-04-30 Thread Archie Cobbs
On Tue, 30 Apr 2024 14:01:37 GMT, Jan Lahoda wrote: > I.e. not trying to be too smart about output, and simply using stdout as > other programs do seems consistent, and most useful - the output can then be > used in pipes, etc. Totally reasonable. But the ssh example is telling - suppose for

Re: RFR: 8330998: System.console() writes to stderr when stdout is redirected [v2]

2024-04-30 Thread Jan Lahoda
On Mon, 29 Apr 2024 20:21:23 GMT, Archie Cobbs wrote: > > Of course the question is if it should write to stderr or /dev/tty like > > mechanism.. > > I was wondering the same thing. My understanding of the definition of > "console" is a bidirectional byte channel with a keyboard & screen on

Re: RFR: 8330998: System.console() writes to stderr when stdout is redirected [v2]

2024-04-29 Thread Archie Cobbs
On Mon, 29 Apr 2024 19:52:17 GMT, Bernd wrote: > Of course the question is if it should write to stderr or /dev/tty like > mechanism.. I was wondering the same thing. My understanding of the definition of "console" is a bidirectional byte channel with a keyboard & screen on the other end. It

Re: RFR: 8330998: System.console() writes to stderr when stdout is redirected [v2]

2024-04-29 Thread Bernd
On Mon, 29 Apr 2024 14:56:23 GMT, Jan Lahoda 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 >> >> >>

Re: RFR: 8330998: System.console() writes to stderr when stdout is redirected [v2]

2024-04-29 Thread Naoto Sato
On Mon, 29 Apr 2024 14:56:23 GMT, Jan Lahoda 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 >> >> >>

Re: RFR: 8330998: System.console() writes to stderr when stdout is redirected [v2]

2024-04-29 Thread Jan Lahoda
> 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