Skip to content

Commit

Permalink
Merge pull request #4613 from povik/err-never-silence
Browse files Browse the repository at this point in the history
log: Never silence `log_cmd_error`
  • Loading branch information
povik authored Oct 7, 2024
2 parents 0556cb5 + b01b176 commit e46cc57
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 0 deletions.
13 changes: 13 additions & 0 deletions kernel/log.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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();
}

Expand Down
9 changes: 9 additions & 0 deletions tests/various/logger_cmd_error.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
#!/usr/bin/env bash

trap 'echo "ERROR in logger_cmd_error.sh" >&2; exit 1' ERR

(../../yosys -v 3 -C <<EOF
yosys -import
hierarchy -top nonexistent
EOF
) 2>&1 | grep -F "ERROR: Module \`nonexistent' not found!" > /dev/null

0 comments on commit e46cc57

Please sign in to comment.