[ospec] don't output colors when pipe or file redirection is used (#2143)

This commit is contained in:
Pierre-Yves Gérardy 2018-05-09 07:58:47 +02:00 committed by GitHub
parent ca1bce9732
commit 43053c6088
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 3 additions and 2 deletions

View file

@ -259,7 +259,7 @@ else window.o = m()
try {return JSON.stringify(value)} catch (e) {return String(value)}
}
function highlight(message) {
return hasProcess ? "\x1b[31m" + message + "\x1b[0m" : "%c" + message + "%c "
return hasProcess ? (process.stdout.isTTY ? "\x1b[31m" + message + "\x1b[0m" : message) : "%c" + message + "%c "
}
o.report = function (results) {