Filter ANSI escape sequences in -L output

Otherwise, builds like NixOS VM tests may leave the terminal in a
weird state and do resets.

(cherry picked from commit 4331eeb13d241dfe2d2e6a01c53915c556cac94f)
This commit is contained in:
Eelco Dolstra 2019-10-09 23:25:06 +02:00
parent e232bf2b69
commit 910b0fcc11
No known key found for this signature in database
GPG key ID: 8170B4726D7198DE

View file

@ -120,7 +120,7 @@ public:
void log(State & state, Verbosity lvl, const std::string & s) void log(State & state, Verbosity lvl, const std::string & s)
{ {
if (state.active) { if (state.active) {
writeToStderr("\r\e[K" + s + ANSI_NORMAL "\n"); writeToStderr("\r\e[K" + filterANSIEscapes(s, !isTTY) + ANSI_NORMAL "\n");
draw(state); draw(state);
} else { } else {
auto s2 = s + ANSI_NORMAL "\n"; auto s2 = s + ANSI_NORMAL "\n";