presto-cli/src/main/java/io/prestosql/cli/Console.java/Console/getPassword
class Console:    private String getPassword()
    {
        checkState(clientOptions.user != null, "Username must be specified along with password");
        String defaultPassword = System.getenv("PRESTO_PASSWORD");
        if (defaultPassword != null) {
            return defaultPassword;
        }

        java.io.Console console = System.console();
        if (console != null) {
            char[] password = console.readPassword("Password: ");
            if (password != null) {
                return new String(password);
            }
            return "";
        }

        try (Terminal terminal = terminal()) {
            LineReader reader = LineReaderBuilder.builder().terminal(terminal).build();
            return reader.readLine("Password: ", (char) 0);
        }
        catch (EndOfFileException e) {
            return "";
        }
        catch (IOException e) {
            throw new UncheckedIOException("Failed to read password from terminal", e);
        }
    }