offlineimap/accounts added Exception with lock file

This patch includes an Exception to catch when two instances of
offlineimap are running.

Signed-off-by: Rodolfo García Peñas (kix) <kix@kix.es>
This commit is contained in:
Rodolfo García Peñas (kix) 2020-09-03 20:07:12 +02:00
parent 0b9b09f265
commit bab7dd00c9

View File

@ -242,6 +242,12 @@ class SyncableAccount(Account):
fcntl.lockf(self._lockfd, fcntl.LOCK_EX | fcntl.LOCK_NB) fcntl.lockf(self._lockfd, fcntl.LOCK_EX | fcntl.LOCK_NB)
except NameError: except NameError:
pass # fnctl not available, disable file locking... :( 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: except IOError:
self._lockfd.close() self._lockfd.close()
raise OfflineImapError( raise OfflineImapError(