about summary refs log tree commit diff stats
diff options
context:
space:
mode:
-rw-r--r--003trace.cc3
-rw-r--r--020run.cc1
2 files changed, 3 insertions, 1 deletions
diff --git a/003trace.cc b/003trace.cc
index 10bdca1c..bd6892a2 100644
--- a/003trace.cc
+++ b/003trace.cc
@@ -152,12 +152,13 @@ struct trace_stream {
 
 
 trace_stream* Trace_stream = NULL;
+int Trace_errors = 0;  // used only when Trace_stream is NULL
 
 // Top-level helper. IMPORTANT: can't nest
 #define trace(...)  !Trace_stream ? cerr /*print nothing*/ : Trace_stream->stream(__VA_ARGS__)
 
 // Errors are a special layer.
-#define raise  (!Trace_stream ? (tb_shutdown(),cerr) /*do print*/ : Trace_stream->stream(Error_depth, "error"))
+#define raise  (!Trace_stream ? (tb_shutdown(),++Trace_errors,cerr) /*do print*/ : Trace_stream->stream(Error_depth, "error"))
 // Inside tests, fail any tests that displayed (unexpected) errors.
 // Expected errors in tests should always be hidden and silently checked for.
 :(before "End Test Teardown")
diff --git a/020run.cc b/020run.cc
index 5d511d66..8cd7c41c 100644
--- a/020run.cc
+++ b/020run.cc
@@ -162,6 +162,7 @@ if (argc > 1) {
 transform_all();
 //? DUMP("");
 //? exit(0);
+if (Trace_errors) return 1;
 save_snapshots();
 
 //: Step 3: if we aren't running tests, locate a recipe called 'main' and