When sys.stdin.fileno() doesn't work, fall back to default_getpass()

-- don't just die.
This commit is contained in:
Guido van Rossum 1998-09-21 20:00:35 +00:00
parent 5fb2631ff9
commit ef0056ae1a
1 changed files with 4 additions and 1 deletions

View File

@ -29,7 +29,10 @@ def getpass(prompt='Password: '):
else: else:
return win_getpass(prompt) 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 old = termios.tcgetattr(fd) # a copy to save
new = old[:] new = old[:]