Detect TTY when deciding whether to enable interactive mode or not
This commit is contained in:
parent
c372797407
commit
1c1b9ef927
1 changed files with 2 additions and 1 deletions
|
@ -1,5 +1,6 @@
|
|||
import getpass
|
||||
import keyring
|
||||
import sys
|
||||
|
||||
from .exceptions import NoStoredPasswordAvailable
|
||||
|
||||
|
@ -7,7 +8,7 @@ from .exceptions import NoStoredPasswordAvailable
|
|||
KEYRING_SYSTEM = 'pyicloud://icloud-password'
|
||||
|
||||
|
||||
def get_password(username, interactive=True):
|
||||
def get_password(username, interactive=sys.stdout.isatty()):
|
||||
try:
|
||||
return get_password_from_keyring(username)
|
||||
except NoStoredPasswordAvailable:
|
||||
|
|
Loading…
Reference in a new issue