fix status code to reflect success or failure to sync

Return value set to 1 if sync failed and error is thrown. Otherwise set to 0 if successful.

Signed-off-by: Prashant Sachdeva <sachdevp@cs.ubc.ca>
Signed-off-by: Nicolas Sebrecht <nicolas.s-dev@laposte.net>
This commit is contained in:
Prashant Sachdeva 2015-09-26 22:28:06 -07:00 committed by Nicolas Sebrecht
parent 54ef0748f2
commit 2f1c856c04

View File

@ -48,7 +48,7 @@ class OfflineImap:
if options.diagnostics: if options.diagnostics:
self.__serverdiagnostics(options) self.__serverdiagnostics(options)
else: else:
self.__sync(options) return self.__sync(options)
def __parse_cmd_options(self): def __parse_cmd_options(self):
parser = OptionParser(version=offlineimap.__bigversion__, parser = OptionParser(version=offlineimap.__bigversion__,
@ -351,11 +351,13 @@ class OfflineImap:
offlineimap.mbnames.write(True) offlineimap.mbnames.write(True)
self.ui.terminate() self.ui.terminate()
return 0
except (SystemExit): except (SystemExit):
raise raise
except Exception as e: except Exception as e:
self.ui.error(e) self.ui.error(e)
self.ui.terminate() self.ui.terminate()
return 1
def __sync_singlethreaded(self, accs): def __sync_singlethreaded(self, accs):
"""Executed if we do not want a separate syncmaster thread """Executed if we do not want a separate syncmaster thread