Skip to content

Commit 3b3df42

Browse files
author
Engelbert Gruber
committed
put an exception around: do_pop user and password entry to catch ctrl-c/d.
1 parent 05fcb66 commit 3b3df42

File tree

1 file changed

+13
-5
lines changed

1 file changed

+13
-5
lines changed

roundup-mailgw

Lines changed: 13 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
# BASIS, AND THERE IS NO OBLIGATION WHATSOEVER TO PROVIDE MAINTENANCE,
1717
# SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS.
1818
#
19-
# $Id: roundup-mailgw,v 1.20 2002-01-07 10:43:48 richard Exp $
19+
# $Id: roundup-mailgw,v 1.21 2002-01-11 07:02:29 grubert Exp $
2020

2121
# python version check
2222
from roundup import version_check
@@ -64,10 +64,15 @@ def do_pop(handler, server, user='', password=''):
6464
'''Read a series of messages from the specified POP server.
6565
'''
6666
import getpass, poplib, socket
67-
if not user:
68-
user = raw_input(_('User: '))
69-
if not password:
70-
password = getpass.getpass()
67+
try:
68+
if not user:
69+
user = raw_input(_('User: '))
70+
if not password:
71+
password = getpass.getpass()
72+
except (KeyboardInterrupt, EOFError):
73+
# Ctrl C or D maybe also Ctrl Z under Windows.
74+
print "\nAborted by user."
75+
return 1
7176

7277
# open a connection to the server and retrieve all messages
7378
try:
@@ -173,6 +178,9 @@ if __name__ == '__main__':
173178

174179
#
175180
# $Log: not supported by cvs2svn $
181+
# Revision 1.20 2002/01/07 10:43:48 richard
182+
# #500329 ] exception on server not reachable-patch
183+
#
176184
# Revision 1.19 2002/01/05 02:19:03 richard
177185
# i18n'ification
178186
#

0 commit comments

Comments
 (0)