From 11003000e81c4af008ecd68a293773c196e21e37 Mon Sep 17 00:00:00 2001 From: "Dirk-Jan C. Binnema" Date: Sat, 23 Sep 2023 09:26:08 +0300 Subject: [PATCH] mu: log warning when exiting with error --- lib/utils/mu-error.hh | 5 ++++- mu/mu.cc | 3 +++ 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/lib/utils/mu-error.hh b/lib/utils/mu-error.hh index c038719f..8bf332e1 100644 --- a/lib/utils/mu-error.hh +++ b/lib/utils/mu-error.hh @@ -189,7 +189,10 @@ private: static inline auto format_as(const Error& err) { - return mu_format("<{} ({})>", err.what(), Error::error_number(err.code())); + return mu_format("<{} ({}:{})>", + err.what(), + Error::error_number(err.code()), + err.exit_code()); } } // namespace Mu diff --git a/mu/mu.cc b/mu/mu.cc index da47b73f..847cd261 100644 --- a/mu/mu.cc +++ b/mu/mu.cc @@ -67,6 +67,9 @@ handle_result(const Result& res, const Mu::Options& opts) col.fg(Color::Blue), col.reset(), col.fg(Color::Green), res.error().hint(), col.reset()); + if (res.error().exit_code() != 0 && !res.error().is_soft_error()) + mu_warning("mu finishing with error: {}", format_as(res.error())); + return res.error().exit_code(); }