aboutsummaryrefslogtreecommitdiff
path: root/src/libstore/build.cc
diff options
context:
space:
mode:
authorEelco Dolstra <eelco.dolstra@logicblox.com>2012-11-15 15:01:02 +0100
committerEelco Dolstra <eelco.dolstra@logicblox.com>2012-11-15 15:01:02 +0100
commit8541d27fce95f1f6a4a6c89bcbc09503ff7ea092 (patch)
tree211d86e5d5724703fc5c58e10044b812089d9420 /src/libstore/build.cc
parent3acc8adcad4066329913cf9ad4e1ccc535f73032 (diff)
Don't use std::cerr in a few places
Slightly scared of using std::cerr in a vforked process...
Diffstat (limited to 'src/libstore/build.cc')
-rw-r--r--src/libstore/build.cc18
1 files changed, 8 insertions, 10 deletions
diff --git a/src/libstore/build.cc b/src/libstore/build.cc
index 3e67e55d4..2fd071eba 100644
--- a/src/libstore/build.cc
+++ b/src/libstore/build.cc
@@ -10,7 +10,6 @@
#include "immutable.hh"
#include <map>
-#include <iostream>
#include <sstream>
#include <algorithm>
#include <boost/shared_ptr.hpp>
@@ -565,7 +564,7 @@ static void runSetuidHelper(const string & command,
throw SysError(format("executing `%1%'") % program);
}
catch (std::exception & e) {
- std::cerr << "error: " << e.what() << std::endl;
+ writeToStderr("error: " + string(e.what()) + "\n");
}
_exit(1);
}
@@ -695,7 +694,7 @@ HookInstance::HookInstance()
throw SysError(format("executing `%1%'") % buildHook);
} catch (std::exception & e) {
- std::cerr << format("build hook error: %1%") % e.what() << std::endl;
+ writeToStderr("build hook error: " + string(e.what()) + "\n");
}
_exit(1);
}
@@ -1547,7 +1546,7 @@ HookReply DerivationGoal::tryBuildHook()
break;
}
s += "\n";
- writeToStderr((unsigned char *) s.data(), s.size());
+ writeToStderr(s);
}
debug(format("hook reply is `%1%'") % reply);
@@ -2141,7 +2140,7 @@ void DerivationGoal::initChild()
throw SysError(format("executing `%1%'") % drv.builder);
} catch (std::exception & e) {
- std::cerr << format("build error: %1%") % e.what() << std::endl;
+ writeToStderr("build error: " + string(e.what()) + "\n");
_exit(inSetup ? childSetupFailed : 1);
}
@@ -2362,7 +2361,7 @@ void DerivationGoal::handleChildOutput(int fd, const string & data)
(!hook && fd == builderOut.readSide))
{
if (verbosity >= settings.buildVerbosity)
- writeToStderr((unsigned char *) data.data(), data.size());
+ writeToStderr(data);
if (bzLogFile) {
int err;
BZ2_bzWrite(&err, bzLogFile, (unsigned char *) data.data(), data.size());
@@ -2372,7 +2371,7 @@ void DerivationGoal::handleChildOutput(int fd, const string & data)
}
if (hook && fd == hook->fromHook.readSide)
- writeToStderr((unsigned char *) data.data(), data.size());
+ writeToStderr(data);
}
@@ -2693,7 +2692,7 @@ void SubstitutionGoal::tryToRun()
throw SysError(format("executing `%1%'") % sub);
} catch (std::exception & e) {
- std::cerr << format("substitute error: %1%") % e.what() << std::endl;
+ writeToStderr("substitute error: " + string(e.what()) + "\n");
}
_exit(1);
}
@@ -2809,8 +2808,7 @@ void SubstitutionGoal::finished()
void SubstitutionGoal::handleChildOutput(int fd, const string & data)
{
assert(fd == logPipe.readSide);
- if (verbosity >= settings.buildVerbosity)
- writeToStderr((unsigned char *) data.data(), data.size());
+ if (verbosity >= settings.buildVerbosity) writeToStderr(data);
/* Don't write substitution output to a log file for now. We
probably should, though. */
}