summaryrefslogtreecommitdiff
path: root/lib/spack/llnl
diff options
context:
space:
mode:
authorJordan Galby <67924449+Jordan474@users.noreply.github.com>2023-12-06 14:58:14 +0100
committerGitHub <noreply@github.com>2023-12-06 14:58:14 +0100
commit8ce110e06912604f7fed880d88b255d3c3200dd6 (patch)
treee5daeaa870fbaa2c75783a571f685ef23594f0ea /lib/spack/llnl
parent90aee11c33a39c6ad62977e45edd1f87528187df (diff)
downloadspack-8ce110e06912604f7fed880d88b255d3c3200dd6.tar.gz
spack-8ce110e06912604f7fed880d88b255d3c3200dd6.tar.bz2
spack-8ce110e06912604f7fed880d88b255d3c3200dd6.tar.xz
spack-8ce110e06912604f7fed880d88b255d3c3200dd6.zip
bootstrap: Don't catch Ctrl-C (#41449)
Diffstat (limited to 'lib/spack/llnl')
-rw-r--r--lib/spack/llnl/util/lang.py9
1 files changed, 6 insertions, 3 deletions
diff --git a/lib/spack/llnl/util/lang.py b/lib/spack/llnl/util/lang.py
index 607b093de8..796aecc502 100644
--- a/lib/spack/llnl/util/lang.py
+++ b/lib/spack/llnl/util/lang.py
@@ -1047,9 +1047,9 @@ class GroupedExceptionHandler:
"""Whether any exceptions were handled."""
return bool(self.exceptions)
- def forward(self, context: str) -> "GroupedExceptionForwarder":
+ def forward(self, context: str, base: type = BaseException) -> "GroupedExceptionForwarder":
"""Return a contextmanager which extracts tracebacks and prefixes a message."""
- return GroupedExceptionForwarder(context, self)
+ return GroupedExceptionForwarder(context, self, base)
def _receive_forwarded(self, context: str, exc: Exception, tb: List[str]):
self.exceptions.append((context, exc, tb))
@@ -1072,15 +1072,18 @@ class GroupedExceptionForwarder:
"""A contextmanager to capture exceptions and forward them to a
GroupedExceptionHandler."""
- def __init__(self, context: str, handler: GroupedExceptionHandler):
+ def __init__(self, context: str, handler: GroupedExceptionHandler, base: type):
self._context = context
self._handler = handler
+ self._base = base
def __enter__(self):
return None
def __exit__(self, exc_type, exc_value, tb):
if exc_value is not None:
+ if not issubclass(exc_type, self._base):
+ return False
self._handler._receive_forwarded(self._context, exc_value, traceback.format_tb(tb))
# Suppress any exception from being re-raised: