Added little patch for compatibility with
This commit is contained in:
parent
6c3e57351b
commit
a7612c23ad
1 changed files with 33 additions and 1 deletions
34
index.js
34
index.js
|
|
@ -3,7 +3,39 @@ var escapeStringRegexp = require('escape-string-regexp');
|
||||||
var ansiStyles = require('ansi-styles');
|
var ansiStyles = require('ansi-styles');
|
||||||
var supportsColor = require('supports-color');
|
var supportsColor = require('supports-color');
|
||||||
var defineProps = Object.defineProperties;
|
var defineProps = Object.defineProperties;
|
||||||
var isSimpleWindowsTerm = process.platform === 'win32' && !/^xterm/i.test(process.env.TERM);
|
var term = '';
|
||||||
|
var platform = '';
|
||||||
|
var scriptRunner = (function () {
|
||||||
|
if (typeof process !== 'undefined' && process.toString() === '[object process]') {
|
||||||
|
return 'node';
|
||||||
|
} else if (typeof phantom !== 'undefined') {
|
||||||
|
return 'phantomjs';
|
||||||
|
}
|
||||||
|
})();
|
||||||
|
|
||||||
|
switch (scriptRunner) {
|
||||||
|
case 'node':
|
||||||
|
platform = process.platform;
|
||||||
|
term = process.env.TERM;
|
||||||
|
|
||||||
|
break;
|
||||||
|
case 'phantomjs':
|
||||||
|
var sys = require('system');
|
||||||
|
|
||||||
|
term = sys.env.TERM;
|
||||||
|
|
||||||
|
if (sys.os.name === 'windows') {
|
||||||
|
platform = 'win32';
|
||||||
|
} else {
|
||||||
|
platform = sys.os.name;
|
||||||
|
}
|
||||||
|
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
throw new Error('Can\'t figure out script runner');
|
||||||
|
}
|
||||||
|
|
||||||
|
var isSimpleWindowsTerm = platform === 'win32' && !/^xterm/i.test(term);
|
||||||
|
|
||||||
function Chalk(options) {
|
function Chalk(options) {
|
||||||
// detect mode if not set manually
|
// detect mode if not set manually
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue