aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--build2/cxx/compile.cxx12
1 files changed, 9 insertions, 3 deletions
diff --git a/build2/cxx/compile.cxx b/build2/cxx/compile.cxx
index 5e7a1b2..c2a6be8 100644
--- a/build2/cxx/compile.cxx
+++ b/build2/cxx/compile.cxx
@@ -1208,10 +1208,16 @@ namespace build2
}
}
- // In case of VC++, we are parsing stderr and if things go south,
- // we need to copy the diagnostics for the user to see.
+ // In case of VC++, we are parsing stderr and if things go
+ // south, we need to copy the diagnostics for the user to see.
//
- if (!is.eof () && cid == "msvc" && bad_error)
+ // Note that the eos check is important: if the stream is at
+ // eos, this and all subsequent writes to cerr will fail (and
+ // you won't see a thing).
+ //
+ if (is.peek () != ifdstream::traits_type::eof () &&
+ cid == "msvc" &&
+ bad_error)
cerr << is.rdbuf ();
is.close ();