Skip to content

Commit 67706b8

Browse files
indutnypiscisaureus
authored andcommitted
Export disableColors from repl, share with debugger
1 parent f4124e1 commit 67706b8

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

lib/_debugger.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -670,7 +670,7 @@ function SourceUnderline(sourceText, position, tty) {
670670
tail = sourceText.slice(position);
671671

672672
// Colourize char if stdout supports colours
673-
if (tty) {
673+
if (tty && !repl.disableColors) {
674674
tail = tail.replace(/(.+?)([^\w]|$)/, '\033[32m$1\033[39m$2');
675675
}
676676

lib/repl.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -56,9 +56,9 @@ function hasOwnProperty(obj, prop) {
5656

5757
var context;
5858

59-
var disableColors = true;
59+
exports.disableColors = true;
6060
if (process.platform != 'win32') {
61-
disableColors = process.env.NODE_DISABLE_COLORS ? true : false;
61+
exports.disableColors = process.env.NODE_DISABLE_COLORS ? true : false;
6262
}
6363

6464

@@ -114,7 +114,7 @@ function REPLServer(prompt, stream, eval) {
114114
this.commands = {};
115115
defineDefaultCommands(this);
116116

117-
if (rli.enabled && !disableColors && exports.writer === util.inspect) {
117+
if (rli.enabled && !exports.disableColors && exports.writer === util.inspect) {
118118
// Turn on ANSI coloring.
119119
exports.writer = function(obj, showHidden, depth) {
120120
return util.inspect(obj, showHidden, depth, true);

0 commit comments

Comments
 (0)