aboutsummaryrefslogtreecommitdiff
path: root/src/libutil/util.cc
diff options
context:
space:
mode:
authorEelco Dolstra <e.dolstra@tudelft.nl>2006-12-03 02:08:13 +0000
committerEelco Dolstra <e.dolstra@tudelft.nl>2006-12-03 02:08:13 +0000
commit7951c3c5460324c652d42f5f92bcae44e0a0b9c7 (patch)
treeda8595f52e710af3313a177cc73a1a1b0cfffe87 /src/libutil/util.cc
parent714fa24cfb5afeb144549e0cc4808cc2a1c459cf (diff)
* Some hackery to propagate the worker's stderr and exceptions to the
client.
Diffstat (limited to 'src/libutil/util.cc')
-rw-r--r--src/libutil/util.cc11
1 files changed, 10 insertions, 1 deletions
diff --git a/src/libutil/util.cc b/src/libutil/util.cc
index 6d96310da..4460d95b8 100644
--- a/src/libutil/util.cc
+++ b/src/libutil/util.cc
@@ -437,7 +437,7 @@ void printMsg_(Verbosity level, const format & f)
else if (logType == ltEscapes && level != lvlInfo)
prefix = "\033[" + escVerbosity(level) + "s";
string s = (format("%1%%2%\n") % prefix % f.str()).str();
- writeFull(STDERR_FILENO, (const unsigned char *) s.c_str(), s.size());
+ writeToStderr((const unsigned char *) s.c_str(), s.size());
}
@@ -450,6 +450,15 @@ void warnOnce(bool & haveWarned, const format & f)
}
+static void defaultWriteToStderr(const unsigned char * buf, size_t count)
+{
+ writeFull(STDERR_FILENO, buf, count);
+}
+
+
+void (*writeToStderr) (const unsigned char * buf, size_t count) = defaultWriteToStderr;
+
+
void readFull(int fd, unsigned char * buf, size_t count)
{
while (count) {