diff options
author | Oliver Reiche <oliver.reiche@huawei.com> | 2022-03-07 13:23:13 +0100 |
---|---|---|
committer | Oliver Reiche <oliver.reiche@huawei.com> | 2022-03-08 13:46:45 +0100 |
commit | d1f1da9ce54efa058681f2d78e427e08c1cb171b (patch) | |
tree | 2ee1d2f1d78615134c4b303d9ba6379a9243632f /src/buildtool/system/system_command.hpp | |
parent | 28abe1bf4d8c16af92e1ef3dc1f267399f0690b9 (diff) | |
download | justbuild-d1f1da9ce54efa058681f2d78e427e08c1cb171b.tar.gz |
SystemCommand: Exit without cleanup on error and avoid logger
Diffstat (limited to 'src/buildtool/system/system_command.hpp')
-rw-r--r-- | src/buildtool/system/system_command.hpp | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/src/buildtool/system/system_command.hpp b/src/buildtool/system/system_command.hpp index 53c92f21..da4e7f38 100644 --- a/src/buildtool/system/system_command.hpp +++ b/src/buildtool/system/system_command.hpp @@ -4,6 +4,7 @@ #include <array> #include <cstdio> #include <cstring> // for strerror() +#include <iostream> #include <iterator> #include <map> #include <optional> @@ -17,6 +18,7 @@ #include "gsl-lite/gsl-lite.hpp" #include "src/buildtool/file_system/file_system_manager.hpp" #include "src/buildtool/logging/logger.hpp" +#include "src/buildtool/system/system.hpp" /// \brief Execute system commands and obtain stdout, stderr and return value. /// Subsequent commands are context free and are not affected by previous @@ -172,12 +174,12 @@ class SystemCommand { ::execvpe(*cmd, cmd, envp); // report error and terminate child process if ::execvp did not exit - logger_.Emit(LogLevel::Error, - "Failed to execute '{}' with error: {}", - *cmd, - strerror(errno)); + std::cerr << fmt::format("Failed to execute '{}' with error: {}", + *cmd, + strerror(errno)) + << std::endl; - std::exit(EXIT_FAILURE); + System::ExitWithoutCleanup(EXIT_FAILURE); } // wait for child to finish and obtain return value |