From a817400d768a13e168a028e28475dd0c013cb5a8 Mon Sep 17 00:00:00 2001 From: Alex Kapranoff Date: Tue, 5 May 2015 16:34:58 +0300 Subject: [PATCH] report exceptions via exit code Now it is possible to handle failed syncs in scripts. Signed-off-by: Alex Kapranoff Signed-off-by: Nicolas Sebrecht --- offlineimap/ui/UIBase.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/offlineimap/ui/UIBase.py b/offlineimap/ui/UIBase.py index 9285b51..14e9304 100644 --- a/offlineimap/ui/UIBase.py +++ b/offlineimap/ui/UIBase.py @@ -500,6 +500,8 @@ class UIBase(object): #print any exceptions that have occurred over the run if not self.exc_queue.empty(): self.warn("ERROR: Exceptions occurred during the run!") + if exitstatus == 0: + exitstatus = 1 while not self.exc_queue.empty(): msg, exc, exc_traceback = self.exc_queue.get() if msg: