mirror of
https://github.com/openjdk/jdk.git
synced 2025-08-26 14:24:46 +02:00
8339347: keytool -importpass insists prompting the user even if there is no terminal
Reviewed-by: weijun
This commit is contained in:
parent
9e1af8cc7c
commit
8fb8cd85b7
2 changed files with 51 additions and 2 deletions
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright (c) 1997, 2023, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 1997, 2024, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
|
@ -1789,7 +1789,8 @@ public final class Main {
|
|||
*/
|
||||
private char[] promptForCredential() throws Exception {
|
||||
// Handle password supplied via stdin
|
||||
if (System.console() == null) {
|
||||
Console console = System.console();
|
||||
if (console == null || !console.isTerminal()) {
|
||||
char[] importPass = Password.readPassword(System.in);
|
||||
passwords.add(importPass);
|
||||
return importPass;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue