By the time we reach the check_ok() at the end, there are resources
that should be released if that call fails.
Signed-off-by: Johannes Berg <johannes@sipsolutions.net>
Reviewed-by: Rob Browning <rlb@defaultvalue.org>
[rlb@defaultvalue.org: adjust commit message]
Tested-by: Rob Browning <rlb@defaultvalue.org>
self.conn.write(b'init-dir %s\n' % self.dir)
else:
self.conn.write(b'set-dir %s\n' % self.dir)
- self.check_ok()
+ try:
+ self.check_ok()
+ except BaseException as ex:
+ with pending_raise(ex):
+ self.close()
self.sync_indexes()
def close(self):