mirror of
https://github.com/YosysHQ/yosys
synced 2025-09-30 21:19:30 +00:00
log: Flush stdout before printing a fatal error to stderr
This hasn't been an issue when using -l to redirect or when stdout is line buffered, explaining how we didn't notice this earlier, but for `yosys ... > log` that extra flush is required to ensure all messages preceding the fatal error are flushed.
This commit is contained in:
parent
71882debe7
commit
86a46b9e5c
1 changed files with 3 additions and 1 deletions
|
@ -331,10 +331,12 @@ static void log_error_with_prefix(std::string_view prefix, std::string str)
|
||||||
if (log_errfile != NULL)
|
if (log_errfile != NULL)
|
||||||
log_files.push_back(log_errfile);
|
log_files.push_back(log_errfile);
|
||||||
|
|
||||||
if (log_error_stderr)
|
if (log_error_stderr) {
|
||||||
|
log_flush(); // Make sure we flush stdout before replacing it with stderr
|
||||||
for (auto &f : log_files)
|
for (auto &f : log_files)
|
||||||
if (f == stdout)
|
if (f == stdout)
|
||||||
f = stderr;
|
f = stderr;
|
||||||
|
}
|
||||||
|
|
||||||
log_last_error = std::move(str);
|
log_last_error = std::move(str);
|
||||||
log("%s%s", prefix, log_last_error);
|
log("%s%s", prefix, log_last_error);
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue