From d4af2cd1a6f1f8b2fa4824d5abc0049fb64c05a2 Mon Sep 17 00:00:00 2001 From: Unrud Date: Mon, 31 Aug 2020 13:54:48 +0200 Subject: [PATCH] Kill storage hook on error --- radicale/storage/multifilesystem/lock.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/radicale/storage/multifilesystem/lock.py b/radicale/storage/multifilesystem/lock.py index e3615e9..81821f2 100644 --- a/radicale/storage/multifilesystem/lock.py +++ b/radicale/storage/multifilesystem/lock.py @@ -62,7 +62,11 @@ class StorageLockMixin: stdout=subprocess.PIPE if debug else subprocess.DEVNULL, stderr=subprocess.PIPE if debug else subprocess.DEVNULL, shell=True, universal_newlines=True, cwd=folder) - stdout_data, stderr_data = p.communicate() + try: + stdout_data, stderr_data = p.communicate() + except BaseException: # e.g. KeyboardInterrupt or SystemExit + p.kill() + raise if stdout_data: logger.debug("Captured stdout hook:\n%s", stdout_data) if stderr_data: