Export disableColors from repl, share with debugger
This commit is contained in:
parent
f4124e18cb
commit
67706b8bb7
@ -670,7 +670,7 @@ function SourceUnderline(sourceText, position, tty) {
|
||||
tail = sourceText.slice(position);
|
||||
|
||||
// Colourize char if stdout supports colours
|
||||
if (tty) {
|
||||
if (tty && !repl.disableColors) {
|
||||
tail = tail.replace(/(.+?)([^\w]|$)/, '\033[32m$1\033[39m$2');
|
||||
}
|
||||
|
||||
|
@ -56,9 +56,9 @@ function hasOwnProperty(obj, prop) {
|
||||
|
||||
var context;
|
||||
|
||||
var disableColors = true;
|
||||
exports.disableColors = true;
|
||||
if (process.platform != 'win32') {
|
||||
disableColors = process.env.NODE_DISABLE_COLORS ? true : false;
|
||||
exports.disableColors = process.env.NODE_DISABLE_COLORS ? true : false;
|
||||
}
|
||||
|
||||
|
||||
@ -114,7 +114,7 @@ function REPLServer(prompt, stream, eval) {
|
||||
this.commands = {};
|
||||
defineDefaultCommands(this);
|
||||
|
||||
if (rli.enabled && !disableColors && exports.writer === util.inspect) {
|
||||
if (rli.enabled && !exports.disableColors && exports.writer === util.inspect) {
|
||||
// Turn on ANSI coloring.
|
||||
exports.writer = function(obj, showHidden, depth) {
|
||||
return util.inspect(obj, showHidden, depth, true);
|
||||
|
Loading…
x
Reference in New Issue
Block a user