mirror of
https://github.com/privatevoid-net/nix-super.git
synced 2024-11-29 09:06:15 +02:00
Really handle carriage return
This commit is contained in:
parent
ce5776758d
commit
21e9d183cc
1 changed files with 9 additions and 4 deletions
|
@ -751,6 +751,7 @@ private:
|
||||||
std::list<std::string> logTail;
|
std::list<std::string> logTail;
|
||||||
|
|
||||||
std::string currentLogLine;
|
std::string currentLogLine;
|
||||||
|
size_t currentLogLinePos = 0; // to handle carriage return
|
||||||
|
|
||||||
/* Pipe for the builder's standard output/error. */
|
/* Pipe for the builder's standard output/error. */
|
||||||
Pipe builderOut;
|
Pipe builderOut;
|
||||||
|
@ -2937,11 +2938,14 @@ void DerivationGoal::handleChildOutput(int fd, const string & data)
|
||||||
|
|
||||||
for (auto c : data)
|
for (auto c : data)
|
||||||
if (c == '\r')
|
if (c == '\r')
|
||||||
currentLogLine.clear(); // FIXME: not quite right
|
currentLogLinePos = 0;
|
||||||
else if (c == '\n')
|
else if (c == '\n')
|
||||||
flushLine();
|
flushLine();
|
||||||
else
|
else {
|
||||||
currentLogLine += c;
|
if (currentLogLinePos >= currentLogLine.size())
|
||||||
|
currentLogLine.resize(currentLogLinePos + 1);
|
||||||
|
currentLogLine[currentLogLinePos++] = c;
|
||||||
|
}
|
||||||
|
|
||||||
if (bzLogFile) {
|
if (bzLogFile) {
|
||||||
int err;
|
int err;
|
||||||
|
@ -2958,7 +2962,7 @@ void DerivationGoal::handleChildOutput(int fd, const string & data)
|
||||||
|
|
||||||
void DerivationGoal::handleEOF(int fd)
|
void DerivationGoal::handleEOF(int fd)
|
||||||
{
|
{
|
||||||
flushLine();
|
if (!currentLogLine.empty()) flushLine();
|
||||||
worker.wakeUp(shared_from_this());
|
worker.wakeUp(shared_from_this());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2972,6 +2976,7 @@ void DerivationGoal::flushLine()
|
||||||
if (logTail.size() > settings.logLines) logTail.pop_front();
|
if (logTail.size() > settings.logLines) logTail.pop_front();
|
||||||
}
|
}
|
||||||
currentLogLine = "";
|
currentLogLine = "";
|
||||||
|
currentLogLinePos = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue