File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -36,7 +36,7 @@ def getpass(prompt='Password: '):
3636 new [3 ] = new [3 ] & ~ TERMIOS .ECHO # 3 == 'lflags'
3737 try :
3838 termios .tcsetattr (fd , TERMIOS .TCSADRAIN , new )
39- passwd = raw_input (prompt )
39+ passwd = _raw_input (prompt )
4040 finally :
4141 termios .tcsetattr (fd , TERMIOS .TCSADRAIN , old )
4242
@@ -66,7 +66,22 @@ def win_getpass(prompt='Password: '):
6666
6767
6868def default_getpass (prompt = 'Password: ' ):
69- return raw_input (prompt )
69+ return _raw_input (prompt )
70+
71+
72+ def _raw_input (prompt = "" ):
73+ # A raw_input() replacement that doesn't save the string in the
74+ # GNU readline history.
75+ import sys
76+ prompt = str (prompt )
77+ if prompt :
78+ sys .stdout .write (prompt )
79+ line = sys .stdin .readline ()
80+ if not line :
81+ raise EOFError
82+ if line [- 1 ] == '\n ' :
83+ line = line [:- 1 ]
84+ return line
7085
7186
7287def getuser ():
You can’t perform that action at this time.
0 commit comments