diff options
author | Peter Collingbourne <peter@pcc.me.uk> | 2011-10-02 00:57:41 (GMT) |
---|---|---|
committer | Peter Collingbourne <peter@pcc.me.uk> | 2011-10-24 00:16:37 (GMT) |
commit | 386cbf6c7e49c88b87f54619b06670ea9f66c8a5 (patch) | |
tree | 1464afeb8a2d6f31bd7249630273f7d579d52ca3 | |
parent | 6fc220b8b98d0a89204f144557d935feb775aeca (diff) | |
download | Ninja-386cbf6c7e49c88b87f54619b06670ea9f66c8a5.zip Ninja-386cbf6c7e49c88b87f54619b06670ea9f66c8a5.tar.gz Ninja-386cbf6c7e49c88b87f54619b06670ea9f66c8a5.tar.bz2 |
Create log entries in BuildLog::RecordCommand without requiring a log file
This permits us to write tests that write and later read from
the build log without needing a temporary log file.
-rw-r--r-- | src/build_log.cc | 6 |
1 files changed, 2 insertions, 4 deletions
diff --git a/src/build_log.cc b/src/build_log.cc index 79143bf..98ce872 100644 --- a/src/build_log.cc +++ b/src/build_log.cc @@ -84,9 +84,6 @@ bool BuildLog::OpenForWrite(const string& path, string* err) { } void BuildLog::RecordCommand(Edge* edge, int start_time, int end_time) { - if (!log_file_) - return; - const string command = edge->EvaluateCommand(); for (vector<Node*>::iterator out = edge->outputs_.begin(); out != edge->outputs_.end(); ++out) { @@ -104,7 +101,8 @@ void BuildLog::RecordCommand(Edge* edge, int start_time, int end_time) { log_entry->start_time = start_time; log_entry->end_time = end_time; - WriteEntry(log_file_, *log_entry); + if (log_file_) + WriteEntry(log_file_, *log_entry); } } |