summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-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;
}