Loading cccli/printer.py +5 −4 Original line number Diff line number Diff line Loading @@ -105,7 +105,7 @@ class Printer(object): if self.readline is not None: self.out(message, fd, nl) def getline(self, prompt, history=True): def getline(self, prompt): '''Read a line from stdin''' try: s = raw_input(prompt) Loading @@ -115,8 +115,6 @@ class Printer(object): raise except Exception as e: raise cliError(str(e)) if not history and s: self.history.removelast() return s def getpass(self, prompt): Loading @@ -127,11 +125,14 @@ class Printer(object): old = termios.tcgetattr(fd) new = termios.tcgetattr(fd) new[3] = new[3] & ~termios.ECHO h = list(self.history) self.history.clear() try: termios.tcsetattr(fd, termios.TCSADRAIN, new) passwd = raw_input(prompt) passwd = self.getline(prompt) finally: termios.tcsetattr(fd, termios.TCSADRAIN, old) self.history.load(h) sys.stdout.write(os.linesep) sys.stdout.flush() return passwd Loading Loading
cccli/printer.py +5 −4 Original line number Diff line number Diff line Loading @@ -105,7 +105,7 @@ class Printer(object): if self.readline is not None: self.out(message, fd, nl) def getline(self, prompt, history=True): def getline(self, prompt): '''Read a line from stdin''' try: s = raw_input(prompt) Loading @@ -115,8 +115,6 @@ class Printer(object): raise except Exception as e: raise cliError(str(e)) if not history and s: self.history.removelast() return s def getpass(self, prompt): Loading @@ -127,11 +125,14 @@ class Printer(object): old = termios.tcgetattr(fd) new = termios.tcgetattr(fd) new[3] = new[3] & ~termios.ECHO h = list(self.history) self.history.clear() try: termios.tcsetattr(fd, termios.TCSADRAIN, new) passwd = raw_input(prompt) passwd = self.getline(prompt) finally: termios.tcsetattr(fd, termios.TCSADRAIN, old) self.history.load(h) sys.stdout.write(os.linesep) sys.stdout.flush() return passwd Loading