diff options
-rw-r--r-- | buildstream/_frontend/main.py | 5 | ||||
-rw-r--r-- | buildstream/_pipeline.py | 28 |
2 files changed, 20 insertions, 13 deletions
diff --git a/buildstream/_frontend/main.py b/buildstream/_frontend/main.py index e62202013..5944a49ac 100644 --- a/buildstream/_frontend/main.py +++ b/buildstream/_frontend/main.py @@ -1014,7 +1014,10 @@ class App(): # if choice == 'shell': click.echo("\nDropping into an interactive shell in the failed build sandbox\n", err=True) - element._shell(Scope.BUILD, failure.sandbox) + try: + element._shell(Scope.BUILD, failure.sandbox) + except BstError as e: + click.echo("Error while attempting to create interactive shell: {}".format(e), err=True) elif choice == 'log': with open(failure.logfile, 'r') as logfile: content = logfile.read() diff --git a/buildstream/_pipeline.py b/buildstream/_pipeline.py index 551861e7c..5894bdaed 100644 --- a/buildstream/_pipeline.py +++ b/buildstream/_pipeline.py @@ -516,18 +516,22 @@ class Pipeline(): .format(directory)) # Stage deps into a temporary sandbox first - with target._prepare_sandbox(Scope.RUN, None, integrate=integrate) as sandbox: - - # Copy or move the sandbox to the target directory - sandbox_root = sandbox.get_directory() - with target.timed_activity("Checking out files in {}".format(directory)): - try: - if hardlinks: - self.checkout_hardlinks(sandbox_root, directory) - else: - utils.copy_files(sandbox_root, directory) - except OSError as e: - raise PipelineError("Failed to checkout files: {}".format(e)) from e + try: + with target._prepare_sandbox(Scope.RUN, None, integrate=integrate) as sandbox: + + # Copy or move the sandbox to the target directory + sandbox_root = sandbox.get_directory() + with target.timed_activity("Checking out files in {}".format(directory)): + try: + if hardlinks: + self.checkout_hardlinks(sandbox_root, directory) + else: + utils.copy_files(sandbox_root, directory) + except OSError as e: + raise PipelineError("Failed to checkout files: {}".format(e)) from e + except BstError as e: + raise PipelineError("Error while staging dependencies into a sandbox: {}".format(e), + reason=e.reason) from e # Helper function for checkout() # |