summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGuido van Rossum <guido@python.org>1998-09-21 20:00:35 (GMT)
committerGuido van Rossum <guido@python.org>1998-09-21 20:00:35 (GMT)
commitef0056ae1a5f6dd2cc10505fb10e7653418d7f1f (patch)
tree001fc82c711a4276f0782cafe0d292249b4bad14
parent5fb2631ff9ca398aea45e001b1b97e9208ca2e9b (diff)
downloadcpython-ef0056ae1a5f6dd2cc10505fb10e7653418d7f1f.zip
cpython-ef0056ae1a5f6dd2cc10505fb10e7653418d7f1f.tar.gz
cpython-ef0056ae1a5f6dd2cc10505fb10e7653418d7f1f.tar.bz2
When sys.stdin.fileno() doesn't work, fall back to default_getpass()
-- don't just die.
-rw-r--r--Lib/getpass.py5
1 files changed, 4 insertions, 1 deletions
diff --git a/Lib/getpass.py b/Lib/getpass.py
index be7a2f9..f0aea63 100644
--- a/Lib/getpass.py
+++ b/Lib/getpass.py
@@ -29,7 +29,10 @@ def getpass(prompt='Password: '):
else:
return win_getpass(prompt)
- fd = sys.stdin.fileno()
+ try:
+ fd = sys.stdin.fileno()
+ except:
+ return default_getpass(prompt)
old = termios.tcgetattr(fd) # a copy to save
new = old[:]