mirror of
https://github.com/python/cpython.git
synced 2025-07-28 13:44:43 +00:00
If sys.stdin is not a tty, fall back to default_getpass after printing
a warning instead of failing with a termios.error.
This commit is contained in:
parent
aa3cadb01e
commit
41e3018336
2 changed files with 7 additions and 0 deletions
|
@ -24,6 +24,10 @@ def unix_getpass(prompt='Password: ', stream=None):
|
|||
if stream is None:
|
||||
stream = sys.stdout
|
||||
|
||||
if not sys.stdin.isatty():
|
||||
print >>sys.stderr, "Warning: sys.stdin is not a tty."
|
||||
return default_getpass(prompt)
|
||||
|
||||
try:
|
||||
fd = sys.stdin.fileno()
|
||||
except:
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue