[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

[dak/master 1/2] 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 <dktrkranz@debian.org>
---
 daklib/utils.py |    7 ++++++-
 1 files changed, 6 insertions(+), 1 deletions(-)

diff --git a/daklib/utils.py b/daklib/utils.py
index 3cc4053..cfbf8aa 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()
-- 
1.6.3.3



Reply to: