summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJan Niklas Hasse <jhasse@bixense.com>2020-11-02 16:02:40 (GMT)
committerGitHub <noreply@github.com>2020-11-02 16:02:40 (GMT)
commit0b5be1489acd5ab0f9d1e6d1734dc10ebbf77e0a (patch)
tree268729c017b304dbfe0b78605901a8de1b6aaa0a
parentd45ff8ebf88ef4add46a80ccdfc2d97a8b4b091b (diff)
parentb0b26cc9c43eb6a3ba728a8bfbcbceeb6dfcab20 (diff)
downloadNinja-0b5be1489acd5ab0f9d1e6d1734dc10ebbf77e0a.zip
Ninja-0b5be1489acd5ab0f9d1e6d1734dc10ebbf77e0a.tar.gz
Ninja-0b5be1489acd5ab0f9d1e6d1734dc10ebbf77e0a.tar.bz2
Merge pull request #1834 from jhasse/close-during-generator
Close BuildLog while running generators, fix #1724
-rw-r--r--src/build.cc4
-rw-r--r--src/build_log.cc3
2 files changed, 5 insertions, 2 deletions
diff --git a/src/build.cc b/src/build.cc
index e3131e2..2fb2aa4 100644
--- a/src/build.cc
+++ b/src/build.cc
@@ -828,6 +828,10 @@ bool Builder::Build(string* err) {
// See if we can start any more commands.
if (failures_allowed && command_runner_->CanRunMore()) {
if (Edge* edge = plan_.FindWork()) {
+ if (edge->GetBindingBool("generator")) {
+ scan_.build_log()->Close();
+ }
+
if (!StartEdge(edge, err)) {
Cleanup();
status_->BuildFinished();
diff --git a/src/build_log.cc b/src/build_log.cc
index 04409c8..4dcd6ce 100644
--- a/src/build_log.cc
+++ b/src/build_log.cc
@@ -183,7 +183,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");
@@ -204,7 +204,6 @@ bool BuildLog::OpenForWriteIfNeeded() {
return false;
}
}
- log_file_path_.clear();
return true;
}