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

Archie Cobbs acobbs at openjdk.org
Tue Apr 30 14:56:04 UTC 2024


On Tue, 30 Apr 2024 14:01:37 GMT, Jan Lahoda <jlahoda at openjdk.org> 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 example someone wanted to implement something like ssh in Java. Would that person expect to be able to do what ssh does (accepting non-echoed passwords) by using `System.console()` ?

In other words, what exactly is `System.console()` supposed to represent? Maybe that question pinpoints the source of the ambiguity here. Of course, it will differ by O/S which adds to the challenge.

These questions are probably beyond the scope of this PR but you've got me curious :)

-------------

PR Comment: https://git.openjdk.org/jdk/pull/18996#issuecomment-2085559962


More information about the core-libs-dev mailing list