aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorEelco Dolstra <eelco.dolstra@logicblox.com>2016-04-25 19:18:28 +0200
committerEelco Dolstra <eelco.dolstra@logicblox.com>2016-04-25 19:18:45 +0200
commitcc804d0dc6c2c565ce9df63ae8557e2696eb2d59 (patch)
treea87248ef035e5b89418aac77db311c668e58bc6d /src
parentca9de88a51cc33f76c54f7f81ce7fbc318bcb848 (diff)
Handle carriage return
Diffstat (limited to 'src')
-rw-r--r--src/libstore/build.cc19
1 files changed, 7 insertions, 12 deletions
diff --git a/src/libstore/build.cc b/src/libstore/build.cc
index 3830d7a67..97433821a 100644
--- a/src/libstore/build.cc
+++ b/src/libstore/build.cc
@@ -2935,18 +2935,13 @@ void DerivationGoal::handleChildOutput(int fd, const string & data)
return;
}
- for (size_t pos = 0; true; ) {
- auto newline = data.find('\n', pos);
-
- if (newline == std::string::npos) {
- currentLogLine.append(data, pos, std::string::npos);
- break;
- }
-
- currentLogLine.append(data, pos, newline - pos);
- flushLine();
- pos = newline + 1;
- }
+ for (auto c : data)
+ if (c == '\r')
+ currentLogLine.clear(); // FIXME: not quite right
+ else if (c == '\n')
+ flushLine();
+ else
+ currentLogLine += c;
if (bzLogFile) {
int err;