mirror of
https://github.com/jashkenas/coffeescript.git
synced 2022-11-09 12:23:24 -05:00
Merge pull request #3892 from matthieubulte/master
Added checking on process.stdout to be compatible with browserify
This commit is contained in:
commit
bd17cc9b3c
2 changed files with 4 additions and 4 deletions
|
@ -201,7 +201,7 @@
|
||||||
};
|
};
|
||||||
|
|
||||||
syntaxErrorToString = function() {
|
syntaxErrorToString = function() {
|
||||||
var codeLine, colorize, colorsEnabled, end, filename, first_column, first_line, last_column, last_line, marker, ref1, ref2, start;
|
var codeLine, colorize, colorsEnabled, end, filename, first_column, first_line, last_column, last_line, marker, ref1, ref2, ref3, ref4, start;
|
||||||
if (!(this.code && this.location)) {
|
if (!(this.code && this.location)) {
|
||||||
return Error.prototype.toString.call(this);
|
return Error.prototype.toString.call(this);
|
||||||
}
|
}
|
||||||
|
@ -218,9 +218,9 @@
|
||||||
end = first_line === last_line ? last_column + 1 : codeLine.length;
|
end = first_line === last_line ? last_column + 1 : codeLine.length;
|
||||||
marker = codeLine.slice(0, start).replace(/[^\s]/g, ' ') + repeat('^', end - start);
|
marker = codeLine.slice(0, start).replace(/[^\s]/g, ' ') + repeat('^', end - start);
|
||||||
if (typeof process !== "undefined" && process !== null) {
|
if (typeof process !== "undefined" && process !== null) {
|
||||||
colorsEnabled = process.stdout.isTTY && !process.env.NODE_DISABLE_COLORS;
|
colorsEnabled = ((ref2 = process.stdout) != null ? ref2.isTTY : void 0) && !((ref3 = process.env) != null ? ref3.NODE_DISABLE_COLORS : void 0);
|
||||||
}
|
}
|
||||||
if ((ref2 = this.colorful) != null ? ref2 : colorsEnabled) {
|
if ((ref4 = this.colorful) != null ? ref4 : colorsEnabled) {
|
||||||
colorize = function(str) {
|
colorize = function(str) {
|
||||||
return "\x1B[1;31m" + str + "\x1B[0m";
|
return "\x1B[1;31m" + str + "\x1B[0m";
|
||||||
};
|
};
|
||||||
|
|
|
@ -173,7 +173,7 @@ syntaxErrorToString = ->
|
||||||
|
|
||||||
# Check to see if we're running on a color-enabled TTY.
|
# Check to see if we're running on a color-enabled TTY.
|
||||||
if process?
|
if process?
|
||||||
colorsEnabled = process.stdout.isTTY and not process.env.NODE_DISABLE_COLORS
|
colorsEnabled = process.stdout?.isTTY and not process.env?.NODE_DISABLE_COLORS
|
||||||
|
|
||||||
if @colorful ? colorsEnabled
|
if @colorful ? colorsEnabled
|
||||||
colorize = (str) -> "\x1B[1;31m#{str}\x1B[0m"
|
colorize = (str) -> "\x1B[1;31m#{str}\x1B[0m"
|
||||||
|
|
Loading…
Add table
Reference in a new issue