diff options
author | Alberto Sartori <alberto.sartori@huawei.com> | 2023-02-13 12:58:24 +0100 |
---|---|---|
committer | Alberto Sartori <alberto.sartori@huawei.com> | 2023-02-15 16:41:10 +0100 |
commit | 9db8ca6f2a95e83849faa9b35860bc2326072b6c (patch) | |
tree | 354167730fd92fcb9e89db14bd441223767f3195 /src/buildtool/execution_api/execution_service/execution_server.cpp | |
parent | 0ef06cc0a77f5262b78d4718f480cee11d7279f1 (diff) | |
download | justbuild-9db8ca6f2a95e83849faa9b35860bc2326072b6c.tar.gz |
just execute: add action's stdout and stderr to cas...
so that they can also be reported on the client side
Diffstat (limited to 'src/buildtool/execution_api/execution_service/execution_server.cpp')
-rw-r--r-- | src/buildtool/execution_api/execution_service/execution_server.cpp | 24 |
1 files changed, 18 insertions, 6 deletions
diff --git a/src/buildtool/execution_api/execution_service/execution_server.cpp b/src/buildtool/execution_api/execution_service/execution_server.cpp index 3e86ca5d..3d33b704 100644 --- a/src/buildtool/execution_api/execution_service/execution_server.cpp +++ b/src/buildtool/execution_api/execution_service/execution_server.cpp @@ -117,18 +117,30 @@ auto ExecutionServiceImpl::Execute( } response.set_cached_result(tmp->IsCached()); - if (tmp->HasStdErr()) { - logger_.Emit(LogLevel::Error, tmp->StdErr()); - } op.set_done(true); ::google::rpc::Status status{}; *(response.mutable_status()) = status; - response.mutable_result()->set_exit_code(tmp->ExitCode()); + auto* result = response.mutable_result(); + result->set_exit_code(tmp->ExitCode()); if (tmp->HasStdErr()) { - response.mutable_result()->set_stderr_raw(tmp->StdErr().data()); + auto dgst = storage_.StoreBlob(tmp->StdErr(), /*is_executable=*/false); + if (!dgst) { + auto str = fmt::format("Could not store stderr of action {}", + request->action_digest().hash()); + logger_.Emit(LogLevel::Error, str); + return ::grpc::Status{grpc::StatusCode::INTERNAL, str}; + } + result->mutable_stderr_digest()->CopyFrom(*dgst); } if (tmp->HasStdOut()) { - response.mutable_result()->set_stdout_raw(tmp->StdOut().data()); + auto dgst = storage_.StoreBlob(tmp->StdOut(), /*is_executable=*/false); + if (!dgst) { + auto str = fmt::format("Could not store stdout of action {}", + request->action_digest().hash()); + logger_.Emit(LogLevel::Error, str); + return ::grpc::Status{grpc::StatusCode::INTERNAL, str}; + } + result->mutable_stdout_digest()->CopyFrom(*dgst); } op.mutable_response()->PackFrom(response); |