diff options
author | Jan Niklas Hasse <jhasse@bixense.com> | 2020-08-26 10:07:25 (GMT) |
---|---|---|
committer | Jan Niklas Hasse <jhasse@bixense.com> | 2020-08-26 10:12:30 (GMT) |
commit | b0b26cc9c43eb6a3ba728a8bfbcbceeb6dfcab20 (patch) | |
tree | 74603a7a70943ae30022896bf3f742a711a3d3ee /src/build_log.cc | |
parent | 9ddd3c917793bb97eb19d571429cdedf07501c03 (diff) | |
download | Ninja-b0b26cc9c43eb6a3ba728a8bfbcbceeb6dfcab20.zip Ninja-b0b26cc9c43eb6a3ba728a8bfbcbceeb6dfcab20.tar.gz Ninja-b0b26cc9c43eb6a3ba728a8bfbcbceeb6dfcab20.tar.bz2 |
Close BuildLog while running generators, fix #1724
While #1780 delayed opening .ninja_log until the first write, this
this didn't fully fix the issue on Windows: There might be build
statements which run before the generator resulting in an actual write
to .ninja_log.
To fix this once and for all the BuildLog now gets closed before running
the generator. BuildLog::log_file_path_ won't be cleared so that it can
be opened again after the generator finished.
Diffstat (limited to 'src/build_log.cc')
-rw-r--r-- | src/build_log.cc | 3 |
1 files changed, 1 insertions, 2 deletions
diff --git a/src/build_log.cc b/src/build_log.cc index e5f179c..c261b20 100644 --- a/src/build_log.cc +++ b/src/build_log.cc @@ -181,7 +181,7 @@ void BuildLog::Close() { } bool BuildLog::OpenForWriteIfNeeded() { - if (log_file_path_.empty()) { + if (log_file_ || log_file_path_.empty()) { return true; } log_file_ = fopen(log_file_path_.c_str(), "ab"); @@ -200,7 +200,6 @@ bool BuildLog::OpenForWriteIfNeeded() { return false; } } - log_file_path_.clear(); return true; } |