Catch CTRL+C and CTRL+D in password prompts
This commit is contained in:
parent
04fd42c63b
commit
f1d57487be
@ -229,7 +229,11 @@ class Config:
|
|||||||
"""
|
"""
|
||||||
if realm.account is None:
|
if realm.account is None:
|
||||||
raise RuntimeError("Can't get password without acccount - should use kerberos instead")
|
raise RuntimeError("Can't get password without acccount - should use kerberos instead")
|
||||||
if self.password_manager:
|
|
||||||
return self.password_manager.get_password(realm.password_name)
|
|
||||||
|
|
||||||
return getpass.getpass(f"Enter password for {realm.password_name}: ")
|
try:
|
||||||
|
if self.password_manager:
|
||||||
|
return self.password_manager.get_password(realm.password_name)
|
||||||
|
|
||||||
|
return getpass.getpass(f"Enter password for {realm.password_name}: ")
|
||||||
|
except (KeyboardInterrupt, EOFError):
|
||||||
|
raise SystemExit("Password prompt / retrieval aborted")
|
||||||
|
Loading…
Reference in New Issue
Block a user