From: grubert Date: Fri, 11 Jan 2002 07:02:29 +0000 (+0000) Subject: put an exception around: do_pop user and password entry to catch ctrl-c/d. X-Git-Url: https://git.tokkee.org/?a=commitdiff_plain;h=b05bf66d9a6c1e03f59dd67f03da24538c3d8fee;p=roundup.git put an exception around: do_pop user and password entry to catch ctrl-c/d. git-svn-id: http://svn.roundup-tracker.org/svnroot/roundup/trunk@532 57a73879-2fb5-44c3-a270-3262357dd7e2 --- diff --git a/roundup-mailgw b/roundup-mailgw index e6de399..a75f438 100755 --- a/roundup-mailgw +++ b/roundup-mailgw @@ -16,7 +16,7 @@ # BASIS, AND THERE IS NO OBLIGATION WHATSOEVER TO PROVIDE MAINTENANCE, # SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS. # -# $Id: roundup-mailgw,v 1.20 2002-01-07 10:43:48 richard Exp $ +# $Id: roundup-mailgw,v 1.21 2002-01-11 07:02:29 grubert Exp $ # python version check from roundup import version_check @@ -64,10 +64,15 @@ def do_pop(handler, server, user='', password=''): '''Read a series of messages from the specified POP server. ''' import getpass, poplib, socket - if not user: - user = raw_input(_('User: ')) - if not password: - password = getpass.getpass() + try: + if not user: + user = raw_input(_('User: ')) + if not password: + password = getpass.getpass() + except (KeyboardInterrupt, EOFError): + # Ctrl C or D maybe also Ctrl Z under Windows. + print "\nAborted by user." + return 1 # open a connection to the server and retrieve all messages try: @@ -173,6 +178,9 @@ if __name__ == '__main__': # # $Log: not supported by cvs2svn $ +# Revision 1.20 2002/01/07 10:43:48 richard +# #500329 ] exception on server not reachable-patch +# # Revision 1.19 2002/01/05 02:19:03 richard # i18n'ification #