diff --git a/lib/tput.js b/lib/tput.js index 9d01c91..3a81de4 100644 --- a/lib/tput.js +++ b/lib/tput.js @@ -2138,6 +2138,11 @@ Tput.prototype.GetConsoleCP = function() { return -1; } + // Allow unicode on all windows consoles for now: + if (+process.env.NCURSES_UNICODE !== 0) { + return 65001; + } + try { // Produces something like: 'Active code page: 437\n\n' ccp = cp.execFileSync(process.env.WINDIR + '\\system32\\chcp.com', [], { @@ -2157,11 +2162,6 @@ Tput.prototype.GetConsoleCP = function() { ccp = +ccp[0]; - // Allow unicode on all windows consoles for now: - if (+process.env.NCURSES_UNICODE !== 0) { - ccp = 65001; - } - return ccp; };