summaryrefslogtreecommitdiff
path: root/buildstream/sandbox/sandbox.py
diff options
context:
space:
mode:
authorTristan Van Berkom <tristan.vanberkom@codethink.co.uk>2019-01-16 15:09:41 -0500
committerTristan Van Berkom <tristan.vanberkom@codethink.co.uk>2019-01-16 19:28:03 -0500
commitd212cdfa6e07abb83e527dcd99d5f6638be942ea (patch)
treeeef1ac4b2b3af5d2530e317c11aa4074b229e914 /buildstream/sandbox/sandbox.py
parentd34a4fd17028e87d5b9402e59e84b803aa475635 (diff)
downloadbuildstream-tristan/error-message-regression.tar.gz
sandbox/sandbox.py: Display failed commands in the detail stringtristan/error-message-regression
We should only display commands in detail strings, not in the message texts. This also updates tests/integration/sandbox-bwrap.py to expect the new message string which only contains the command exit status and not the whole command itself, this does not alter the validity of the text case which is checking that we can obtain the expected return value.
Diffstat (limited to 'buildstream/sandbox/sandbox.py')
-rw-r--r--buildstream/sandbox/sandbox.py9
1 files changed, 5 insertions, 4 deletions
diff --git a/buildstream/sandbox/sandbox.py b/buildstream/sandbox/sandbox.py
index 4a1e81008..cb6f43314 100644
--- a/buildstream/sandbox/sandbox.py
+++ b/buildstream/sandbox/sandbox.py
@@ -86,10 +86,11 @@ class SandboxCommandError(SandboxError):
Args:
message (str): The error message to report to the user
+ detail (str): The detailed error string
collect (str): An optional directory containing partial install contents
"""
- def __init__(self, message, *, collect=None):
- super().__init__(message, reason='command-failed')
+ def __init__(self, message, *, detail=None, collect=None):
+ super().__init__(message, detail=detail, reason='command-failed')
self.collect = collect
@@ -599,8 +600,8 @@ class _SandboxBatch():
if exitcode != 0:
cmdline = ' '.join(shlex.quote(cmd) for cmd in command.command)
label = command.label or cmdline
- raise SandboxCommandError("Command '{}' failed with exitcode {}".format(label, exitcode),
- collect=self.collect)
+ raise SandboxCommandError("Command failed with exitcode {}".format(exitcode),
+ detail=label, collect=self.collect)
def execute_call(self, call):
call.callback()