From 3e3515e7d9a0f74503245ccd1b2ff4456fa619f9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Martin=20Povi=C5=A1er?= Date: Tue, 24 Sep 2024 17:46:50 +0200 Subject: [PATCH] log: Never silence `log_cmd_error` Add extra handling to arrange for `log_cmd_error` never being silenced by the command line `-v N` option. Similar path for `log_error` exists already. --- kernel/log.cc | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/kernel/log.cc b/kernel/log.cc index 55895da06d7..fabbe09fd2f 100644 --- a/kernel/log.cc +++ b/kernel/log.cc @@ -459,8 +459,21 @@ void log_cmd_error(const char *format, ...) if (log_cmd_error_throw) { log_last_error = vstringf(format, ap); + + // Make sure the error message gets through any selective silencing + // of log output + bool pop_errfile = false; + if (log_errfile != NULL) { + log_files.push_back(log_errfile); + pop_errfile = true; + } + log("ERROR: %s", log_last_error.c_str()); log_flush(); + + if (pop_errfile) + log_files.pop_back(); + throw log_cmd_error_exception(); }