patch for distribution getpass.py
David B Terrell
dbt at meat.net
Fri Aug 31 20:27:22 EDT 2001
getpass (on unix anyway) should print the prompt to stderr or better
yet /dev/tty (I was too lazy to implement that one) and get the
prompt from /dev/tty. This way you can use redirection of stdin or
stdout but still prompt the user for password input.
--- getpass.py.orig Tue Feb 27 13:23:31 2001
+++ getpass.py Fri Aug 31 17:14:49 2001
@@ -37,7 +37,7 @@
finally:
termios.tcsetattr(fd, termios.TCSADRAIN, old)
- sys.stdout.write('\n')
+ sys.stderr.write('\n')
return passwd
@@ -73,7 +73,7 @@
import sys
prompt = str(prompt)
if prompt:
- sys.stdout.write(prompt)
+ sys.stderr.write(prompt)
line = sys.stdin.readline()
if not line:
raise EOFError
--
David Terrell | "Instead of plodding through the equivalent of
Prime Minister, NebCorp | literary Xanax, the pregeeks go for sci-fi and
dbt at meat.net | fantasy: LSD in book form." - Benjy Feen,
http://wwn.nebcorp.com | http://www.monkeybagel.com/ "Origins of Sysadmins"
More information about the Python-list
mailing list