summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/buildtool/execution_engine/executor/TARGETS1
-rw-r--r--src/buildtool/execution_engine/executor/executor.hpp18
2 files changed, 14 insertions, 5 deletions
diff --git a/src/buildtool/execution_engine/executor/TARGETS b/src/buildtool/execution_engine/executor/TARGETS
index 6855f87b..7a7718dd 100644
--- a/src/buildtool/execution_engine/executor/TARGETS
+++ b/src/buildtool/execution_engine/executor/TARGETS
@@ -17,6 +17,7 @@
, ["src/buildtool/execution_api/remote", "bazel"]
, ["src/buildtool/progress_reporting", "progress"]
, ["src/utils/cpp", "hex_string"]
+ , ["src/utils/cpp", "prefix"]
, ["@", "gsl", "", "gsl"]
, ["src/buildtool/common", "common"]
, ["src/buildtool/common/remote", "remote_common"]
diff --git a/src/buildtool/execution_engine/executor/executor.hpp b/src/buildtool/execution_engine/executor/executor.hpp
index ad933a93..d84f4e7e 100644
--- a/src/buildtool/execution_engine/executor/executor.hpp
+++ b/src/buildtool/execution_engine/executor/executor.hpp
@@ -45,6 +45,7 @@
#include "src/buildtool/logging/logger.hpp"
#include "src/buildtool/progress_reporting/progress.hpp"
#include "src/utils/cpp/hex_string.hpp"
+#include "src/utils/cpp/prefix.hpp"
/// \brief Implementations for executing actions and uploading artifacts.
class ExecutorImpl {
@@ -594,20 +595,27 @@ class ExecutorImpl {
auto build_message = [has_err, has_out, &logger, &action, &response]() {
using namespace std::string_literals;
auto message = ""s;
+ bool has_both = has_err and has_out;
if (has_err or has_out) {
- message += (has_err and has_out ? "Stdout and stderr"s
- : has_out ? "Stdout"s
- : "Stderr"s) +
+ message += (has_both ? "Output"s
+ : has_out ? "Stdout"s
+ : "Stderr"s) +
" of command ";
}
message += nlohmann::json(action->Command()).dump() +
" in environment " +
nlohmann::json(action->Env()).dump() + "\n";
if (response->HasStdOut()) {
- message += response->StdOut();
+ if (has_both) {
+ message += "Stdout:\n";
+ }
+ message += PrefixLines(response->StdOut());
}
if (response->HasStdErr()) {
- message += response->StdErr();
+ if (has_both) {
+ message += "Stderr:\n";
+ }
+ message += PrefixLines(response->StdErr());
}
return message;
};