diff options
author | Nico Weber <nicolasweber@gmx.de> | 2013-04-09 04:11:34 (GMT) |
---|---|---|
committer | Nico Weber <nicolasweber@gmx.de> | 2013-04-09 04:11:34 (GMT) |
commit | 7920d7032a8833004fc281fb5b090787888d0fd0 (patch) | |
tree | 671485e2811e7716b6e9e809bc6aef1840097808 /src/build.cc | |
parent | 10d1c939ae788bfb410eb37c7e71da2be07797f9 (diff) | |
download | Ninja-7920d7032a8833004fc281fb5b090787888d0fd0.zip Ninja-7920d7032a8833004fc281fb5b090787888d0fd0.tar.gz Ninja-7920d7032a8833004fc281fb5b090787888d0fd0.tar.bz2 |
refactor; no intended functionality change
Diffstat (limited to 'src/build.cc')
-rw-r--r-- | src/build.cc | 20 |
1 files changed, 13 insertions, 7 deletions
diff --git a/src/build.cc b/src/build.cc index a98dfda..efa4559 100644 --- a/src/build.cc +++ b/src/build.cc @@ -115,13 +115,18 @@ void BuildStatus::BuildEdgeFinished(Edge* edge, if (printer_.smart_terminal_) PrintStatus(edge); - if (!success || !output.empty()) { - if (printer_.smart_terminal_) + if (!success) { + if (!printer_.have_blank_line_) printf("\n"); // Print the command that is spewing before printing its output. - if (!success) - printf("FAILED: %s\n", edge->EvaluateCommand().c_str()); + printf("FAILED: %s\n", edge->EvaluateCommand().c_str()); + printer_.have_blank_line_ = true; + } + + if (!output.empty()) { + if (!printer_.have_blank_line_) + printf("\n"); // ninja sets stdout and stderr of subprocesses to a pipe, to be able to // check if the output is empty. Some compilers, e.g. clang, check @@ -141,10 +146,11 @@ void BuildStatus::BuildEdgeFinished(Edge* edge, else final_output = output; - if (!final_output.empty()) + if (!final_output.empty()) { printf("%s", final_output.c_str()); - - printer_.have_blank_line_ = true; + if (*final_output.rbegin() == '\n') + printer_.have_blank_line_ = true; + } } } |