Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

log: Never silence log_cmd_error #4613

Merged
merged 2 commits into from
Oct 7, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading