diff options
author | Jürg Billeter <j@bitron.ch> | 2020-02-20 08:51:56 +0100 |
---|---|---|
committer | Jürg Billeter <j@bitron.ch> | 2020-02-20 10:56:22 +0100 |
commit | 802165cc287089652c9800b28102d3af9532d5b4 (patch) | |
tree | bf8326f72e7bcce4bf005a574ae8eb20d80a53c2 | |
parent | cccf7425aa0b952b771df037a512873aea53b02c (diff) | |
download | buildstream-802165cc287089652c9800b28102d3af9532d5b4.tar.gz |
_sandboxremote.py: Support stdout and stderr digestsjuerg/reapi-log
Fetch blobs from remote CAS and then forward them to the sandbox output.
-rw-r--r-- | src/buildstream/sandbox/_sandboxremote.py | 14 |
1 files changed, 12 insertions, 2 deletions
diff --git a/src/buildstream/sandbox/_sandboxremote.py b/src/buildstream/sandbox/_sandboxremote.py index fe7812ba5..3dcbb2ccc 100644 --- a/src/buildstream/sandbox/_sandboxremote.py +++ b/src/buildstream/sandbox/_sandboxremote.py @@ -19,6 +19,7 @@ # Jim MacArthur <jim.macarthur@codethink.co.uk> import os +import shutil from collections import namedtuple from urllib.parse import urlparse from functools import partial @@ -377,12 +378,21 @@ class SandboxRemote(SandboxREAPI): # Now do a pull to ensure we have the full directory structure. cascache.pull_tree(casremote, tree_digest) + # Fetch stdout and stderr blobs + cascache.fetch_blobs(casremote, [action_result.stdout_digest, action_result.stderr_digest]) + # Forward remote stdout and stderr if stdout: - if action_result.stdout_raw: + if action_result.stdout_digest.hash: + with open(cascache.objpath(action_result.stdout_digest), "r") as f: + shutil.copyfileobj(f, stdout) + elif action_result.stdout_raw: stdout.write(str(action_result.stdout_raw, "utf-8", errors="ignore")) if stderr: - if action_result.stderr_raw: + if action_result.stderr_digest.hash: + with open(cascache.objpath(action_result.stderr_digest), "r") as f: + shutil.copyfileobj(f, stderr) + elif action_result.stderr_raw: stderr.write(str(action_result.stderr_raw, "utf-8", errors="ignore")) return action_result |