From: Luca Falavigna Date: Tue, 24 Nov 2009 07:36:27 +0000 (+0000) Subject: Handle broken pipe while waiting for action X-Git-Url: https://err.no/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=94465f743590cc9a5f58d1aebff2bfb75e023f5d;p=dak Handle broken pipe while waiting for action our_raw_input waits for action, but an exception is raised if user does not provide it. Loop until a correct action is taken, this way dak does not horribly crash each time. Signed-off-by: Luca Falavigna --- diff --git a/daklib/utils.py b/daklib/utils.py index 3cc40538..cfbf8aa0 100644 --- a/daklib/utils.py +++ b/daklib/utils.py @@ -115,7 +115,12 @@ def open_file(filename, mode='r'): def our_raw_input(prompt=""): if prompt: - sys.stdout.write(prompt) + while 1: + try: + sys.stdout.write(prompt) + break + except IOError: + pass sys.stdout.flush() try: ret = raw_input()