changeset 7798:57fee79e5588

catch CTRL-D at password prompt We caught this exception in ui.prompt(), but not here. Without this, hitting CTRL-D at the password prompt gives a long traceback.
author Steve Borho <steve@borho.org>
date Sat, 21 Feb 2009 17:46:06 -0600
parents e48cc2315fe6
children 43edbd8cc1e0
files mercurial/ui.py
diffstat 1 files changed, 4 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/mercurial/ui.py	Wed Feb 04 22:12:55 2009 +0100
+++ b/mercurial/ui.py	Sat Feb 21 17:46:06 2009 -0600
@@ -439,7 +439,10 @@
 
     def getpass(self, prompt=None, default=None):
         if not self.interactive: return default
-        return getpass.getpass(prompt or _('password: '))
+        try:
+            return getpass.getpass(prompt or _('password: '))
+        except EOFError:
+            raise util.Abort(_('response expected'))
     def status(self, *msg):
         if not self.quiet: self.write(*msg)
     def warn(self, *msg):