diff options
author | Evan Martin <martine@danga.com> | 2011-01-08 00:32:38 (GMT) |
---|---|---|
committer | Evan Martin <martine@danga.com> | 2011-01-08 00:32:38 (GMT) |
commit | 08a5452d05eae55bec40cd351718d62fd767227c (patch) | |
tree | ff6b10249c3400df7d7cf18bdd11788c4df6523d /src/build_log.cc | |
parent | be51721782291cf5f8087729c574b1182f98c96c (diff) | |
download | Ninja-08a5452d05eae55bec40cd351718d62fd767227c.zip Ninja-08a5452d05eae55bec40cd351718d62fd767227c.tar.gz Ninja-08a5452d05eae55bec40cd351718d62fd767227c.tar.bz2 |
don't crash in tests where we don't use a log file
Diffstat (limited to 'src/build_log.cc')
-rw-r--r-- | src/build_log.cc | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/src/build_log.cc b/src/build_log.cc index 4ee7cf1..666b80b 100644 --- a/src/build_log.cc +++ b/src/build_log.cc @@ -12,6 +12,8 @@ // older runs. // XXX figure out recompaction strategy +BuildLog::BuildLog() : log_file_(NULL) {} + bool BuildLog::OpenForWrite(const string& path, string* err) { log_file_ = fopen(path.c_str(), "ab"); if (!log_file_) { @@ -23,6 +25,9 @@ bool BuildLog::OpenForWrite(const string& path, string* err) { } void BuildLog::RecordCommand(Edge* edge, int time_ms) { + if (!log_file_) + return; + const string command = edge->EvaluateCommand(); for (vector<Node*>::iterator out = edge->outputs_.begin(); out != edge->outputs_.end(); ++out) { |