summaryrefslogtreecommitdiff
path: root/src/buildtool/execution_engine/executor/executor.hpp
diff options
context:
space:
mode:
authorKlaus Aehlig <klaus.aehlig@huawei.com>2022-03-04 11:57:08 +0100
committerKlaus Aehlig <klaus.aehlig@huawei.com>2022-03-04 13:32:43 +0100
commit7ed8ff309907dd336cdca8a3e38eecfbe1f3b00f (patch)
treee102ab62760cbd565c4d16fb3bff00df0704231a /src/buildtool/execution_engine/executor/executor.hpp
parent3b7b4d7b64aebc4484f4d51d887af1fcbda763ec (diff)
downloadjustbuild-7ed8ff309907dd336cdca8a3e38eecfbe1f3b00f.tar.gz
executor: fix json reporting of commands
When reporting a command that failed, or produced some output, report it as a list of strings, not as a singleton-list consisting of a list of strings. While there, improve wording of message; in particular, avoid confussion between a command that errored and one that produced outout on stderr.
Diffstat (limited to 'src/buildtool/execution_engine/executor/executor.hpp')
-rw-r--r--src/buildtool/execution_engine/executor/executor.hpp15
1 files changed, 8 insertions, 7 deletions
diff --git a/src/buildtool/execution_engine/executor/executor.hpp b/src/buildtool/execution_engine/executor/executor.hpp
index 6ed5a55f..d21346a0 100644
--- a/src/buildtool/execution_engine/executor/executor.hpp
+++ b/src/buildtool/execution_engine/executor/executor.hpp
@@ -324,11 +324,12 @@ class ExecutorImpl {
auto has_out = response->HasStdOut();
if (has_err or has_out) {
logger.Emit(LogLevel::Info, [&] {
- auto message = std::string{has_err and has_out
- ? "Output and error"
- : has_out ? "Output" : "Error"} +
- " of command: ";
- message += nlohmann::json{command}.dump();
+ using namespace std::string_literals;
+ auto message =
+ (has_err and has_out ? "Stdout and stderr"s
+ : has_out ? "Stdout"s : "Stderr"s) +
+ " of command: ";
+ message += nlohmann::json(command).dump();
if (response->HasStdOut()) {
message += "\n" + response->StdOut();
}
@@ -343,8 +344,8 @@ class ExecutorImpl {
void static PrintError(Logger const& logger,
std::vector<std::string> const& command) noexcept {
logger.Emit(LogLevel::Error,
- "Failed to execute command:\n{}",
- nlohmann::json{command}.dump());
+ "Failed to execute command {}",
+ nlohmann::json(command).dump());
}
};