citrun

watch C/C++ source code execute
Log | Files | Refs | LICENSE

commit ebdd2c16db950e071ea2f09dcaca335149e2a068
parent f2c83a2daeee9a979448fa1ea005332321ee17c2
Author: Kyle Milz <kyle@0x30.net>
Date:   Mon,  5 Dec 2016 18:30:20 -0700

src: don't log if there was an error opening the file

Diffstat:
Msrc/inst_log.h | 8+++++---
1 file changed, 5 insertions(+), 3 deletions(-)

diff --git a/src/inst_log.h b/src/inst_log.h @@ -24,18 +24,20 @@ class InstrumentLogger : public std::ostream m_iscitruninst(false) { if (m_ec.value()) - std::cerr << "Can't open citrun.log: " << m_ec.message(); + std::cerr << "Can't open citrun.log: " << m_ec.message(); } virtual int sync() { - m_outfile << m_pid << ": " << str(); + if (!m_ec.value()) { + m_outfile << m_pid << ": " << str(); + m_outfile.flush(); + } if (m_iscitruninst) llvm::outs() << str(); str(""); - m_outfile.flush(); return 0; } };