From bab7dd00c9cfd7ca4ec709ebf03aa64fec6cf0fd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rodolfo=20Garc=C3=ADa=20Pe=C3=B1as=20=28kix=29?= Date: Thu, 3 Sep 2020 20:07:12 +0200 Subject: [PATCH] offlineimap/accounts added Exception with lock file MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This patch includes an Exception to catch when two instances of offlineimap are running. Signed-off-by: Rodolfo García Peñas (kix) --- offlineimap/accounts.py | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/offlineimap/accounts.py b/offlineimap/accounts.py index 14ce6f3..00342e1 100644 --- a/offlineimap/accounts.py +++ b/offlineimap/accounts.py @@ -242,6 +242,12 @@ class SyncableAccount(Account): fcntl.lockf(self._lockfd, fcntl.LOCK_EX | fcntl.LOCK_NB) except NameError: pass # fnctl not available, disable file locking... :( + except IOError: + raise OfflineImapError( + "Could not lock account %s. Is another " + "instance using this account?" % self, + OfflineImapError.ERROR.REPO, + exc_info()[2]) except IOError: self._lockfd.close() raise OfflineImapError(