include command name when printing output, add newline
authorEvan Martin <martine@danga.com>
Sat, 5 Feb 2011 19:32:40 +0000 (11:32 -0800)
committerEvan Martin <martine@danga.com>
Sat, 5 Feb 2011 19:34:22 +0000 (11:34 -0800)
src/build.cc

index b380845..254d4dc 100644 (file)
@@ -268,12 +268,16 @@ Edge* RealCommandRunner::NextFinishedCommand(bool* success) {
   Edge* edge = i->second;
   subproc_to_edge_.erase(i);
 
-  if (!*success)
-    printf("FAILED: %s\n", edge->EvaluateCommand().c_str());
-  if (!subproc->stdout_.buf_.empty())
-    printf("%s\n", subproc->stdout_.buf_.c_str());
-  if (!subproc->stderr_.buf_.empty())
-    printf("%s\n", subproc->stderr_.buf_.c_str());
+  if (!*success ||
+      !subproc->stdout_.buf_.empty() ||
+      !subproc->stderr_.buf_.empty()) {
+    printf("\n%s%s\n", *success ? "" : "FAILED: ",
+           edge->EvaluateCommand().c_str());
+    if (!subproc->stdout_.buf_.empty())
+      printf("%s\n", subproc->stdout_.buf_.c_str());
+    if (!subproc->stderr_.buf_.empty())
+      printf("%s\n", subproc->stderr_.buf_.c_str());
+  }
 
   delete subproc;
   return edge;