fix: disable colour if stdout redirected

This commit is contained in:
Remy Sharp
2017-12-21 08:52:38 +00:00
parent 4589bc8a60
commit 990fbfd153
3 changed files with 11 additions and 3 deletions

View File

@@ -3,7 +3,7 @@ Configuration
--config <file> .......... alternate nodemon.json config file to use
--exitcrash .............. exit on crash, allows nodemon to work with other watchers
-i, --ignore ............. ignore specific files or directories
--no-colors .............. disable color output
--[no-]color ............. toggle color output
--signal <signal> ........ use specified kill signal instead of default (ex. SIGTERM)
-w, --watch dir........... watch directory "dir" or files. use once for each
directory or file to watch

View File

@@ -175,10 +175,18 @@ function nodemonOption(options, arg, eatNext) {
options.ext = eatNext();
} else
if (arg === '--no-colours' || arg === '--no-colors') {
if (arg === '--no-colours' || arg === '--no-colors'
|| arg === '--no-colour'
|| arg === '--no-color') {
options.colours = false;
} else
if (arg === '--colours' || arg === '--colors'
|| arg === '--colour'
|| arg === '--color') {
options.colours = true;
} else
if (arg === '--signal' || arg === '-s') {
options.signal = eatNext();
} else

View File

@@ -3,7 +3,7 @@ var ignoreRoot = require('ignore-by-default').directories();
// default options for config.options
module.exports = {
restartable: 'rs',
colours: true,
colours: process.stdout.isTTY,
execMap: {
py: 'python',
rb: 'ruby',