about summary refs log tree commit diff
path: root/src/libstore
diff options
context:
space:
mode:
authorEelco Dolstra <eelco.dolstra@logicblox.com>2014-08-20T14·01+0200
committerEelco Dolstra <eelco.dolstra@logicblox.com>2014-08-20T14·50+0200
commit373fad75e19a2f24db512621b8cedb627d03d49d (patch)
tree640fd0cac2ccc58f2db5a3f39eba6d0d67badb22 /src/libstore
parent392430b2c4ceb2e476abe2b3acc928581b2a1445 (diff)
Add some color
Diffstat (limited to 'src/libstore')
-rw-r--r--src/libstore/build.cc38
1 files changed, 1 insertions, 37 deletions
diff --git a/src/libstore/build.cc b/src/libstore/build.cc
index ef0a304dea3b..d93b5607d8a6 100644
--- a/src/libstore/build.cc
+++ b/src/libstore/build.cc
@@ -2441,42 +2441,6 @@ void DerivationGoal::deleteTmpDir(bool force)
 }
 
 
-/* Filter out the special ANSI escape codes generated by Nixpkgs'
-   stdenv (used to denote nesting etc.). */
-static string filterNixEscapes(const string & s)
-{
-    string t, r;
-    enum { stTop, stEscape, stCSI } state = stTop;
-    for (auto c : s) {
-        if (state == stTop) {
-            if (c == '\e') {
-                state = stEscape;
-                r = c;
-            } else
-                t += c;
-        } else if (state == stEscape) {
-            r += c;
-            if (c == '[')
-                state = stCSI;
-            else {
-                t += r;
-                state = stTop;
-            }
-        } else {
-            r += c;
-            if (c >= 0x40 && c != 0x7e) {
-                if (c != 'p' && c != 'q' && c != 's' && c != 'a' && c != 'b')
-                    t += r;
-                state = stTop;
-                r.clear();
-            }
-        }
-    }
-    t += r;
-    return t;
-}
-
-
 void DerivationGoal::handleChildOutput(int fd, const string & data)
 {
     if ((hook && fd == hook->builderOut.readSide) ||
@@ -2491,7 +2455,7 @@ void DerivationGoal::handleChildOutput(int fd, const string & data)
             return;
         }
         if (verbosity >= settings.buildVerbosity)
-            writeToStderr(filterNixEscapes(data));
+            writeToStderr(filterANSIEscapes(data, true));
         if (bzLogFile) {
             int err;
             BZ2_bzWrite(&err, bzLogFile, (unsigned char *) data.data(), data.size());