From 720b17be02f20de3dcbd7b94d349adc89f090435 Mon Sep 17 00:00:00 2001 From: Neil Locketz Date: Wed, 30 Jan 2019 09:35:03 -0500 Subject: [PATCH] Disable colors for non-interactive output --- lib/compile.js | 3 ++- lib/wpwatch.js | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/lib/compile.js b/lib/compile.js index 679bdee5d..64da03dd0 100644 --- a/lib/compile.js +++ b/lib/compile.js @@ -3,6 +3,7 @@ const _ = require('lodash'); const BbPromise = require('bluebird'); const webpack = require('webpack'); +const tty = require('tty'); module.exports = { compile() { @@ -20,7 +21,7 @@ module.exports = { const compileOutputPaths = []; const consoleStats = this.webpackConfig.stats || _.get(this, 'webpackConfig[0].stats') || { - colors: true, + colors: tty.isatty(process.stdout.fd), hash: false, version: false, chunks: false, diff --git a/lib/wpwatch.js b/lib/wpwatch.js index 4e1022626..2345a7242 100644 --- a/lib/wpwatch.js +++ b/lib/wpwatch.js @@ -3,6 +3,7 @@ const _ = require('lodash'); const BbPromise = require('bluebird'); const webpack = require('webpack'); +const tty = require('tty'); module.exports = { wpwatch() { @@ -23,7 +24,7 @@ module.exports = { const compiler = webpack(this.webpackConfig); const consoleStats = this.webpackConfig.stats || { - colors: true, + colors: tty.isatty(process.stdout.fd), hash: false, version: false, chunks: false,