Many Unix programs such as mysql
and expect
are able to send messages directly to the user’s tty
, bypassing redirected stdout and stderr streams. For example, mysql
is able to print a password prompt, and expect
has send_tty
.
Is there a built-in way to do this in Java, or is my only option to manually open /dev/tty
and write to it?
I tried to use System.console() methods, but the console() is null when standard streams are redirected.