Skip to content

Commit 4049db7

Browse files
author
Pepijn Verlaan
committed
Only use colors when stdout is a TTY
1 parent f6bf7de commit 4049db7

1 file changed

Lines changed: 5 additions & 1 deletion

File tree

lib/log.js

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,11 @@ module.exports = function(cfg) {
2020
}
2121

2222
function color(s, c) {
23-
return '\x1B[' + c + 'm' + s + '\x1B[0m'
23+
if (process.stdout.isTTY) {
24+
return '\x1B[' + c + 'm' + s + '\x1B[0m'
25+
} else {
26+
return s;
27+
}
2428
}
2529

2630
log.info = function() {

0 commit comments

Comments
 (0)