summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--buildstream/_artifactcache/ostreecache.py18
1 files changed, 14 insertions, 4 deletions
diff --git a/buildstream/_artifactcache/ostreecache.py b/buildstream/_artifactcache/ostreecache.py
index 9987746b0..c5178a646 100644
--- a/buildstream/_artifactcache/ostreecache.py
+++ b/buildstream/_artifactcache/ostreecache.py
@@ -20,10 +20,11 @@
import multiprocessing
import os
+import signal
import string
import tempfile
-from .. import _ostree, utils
+from .. import _ostree, _signals, utils
from .._exceptions import ArtifactError
from ..element import _KeyStrength
from .._ostree import OSTreeError
@@ -411,9 +412,18 @@ class OSTreeCache(ArtifactCache):
q = multiprocessing.Queue()
for url in self.urls:
p = multiprocessing.Process(target=child_action, args=(url, q))
- p.start()
- exception, push_url, pull_url, remote_refs = q.get()
- p.join()
+
+ try:
+
+ # Keep SIGINT blocked in the child process
+ with _signals.blocked([signal.SIGINT], ignore=False):
+ p.start()
+
+ exception, push_url, pull_url, remote_refs = q.get()
+ p.join()
+ except KeyboardInterrupt:
+ utils._kill_process_tree(p.pid)
+ raise
if exception and on_failure:
on_failure(url, exception)