GetConsoleCP fixes. see #130.

This commit is contained in:
Christopher Jeffrey 2015-04-25 16:59:31 -07:00
parent f2d809d57b
commit cbed0b449a
1 changed files with 9 additions and 2 deletions

View File

@ -2141,8 +2141,9 @@ Tput.prototype.GetConsoleCP = function() {
try {
// Produces something like: 'Active code page: 437\n\n'
ccp = cp.execFileSync(process.env.WINDIR + '\\system32\\chcp.com', [], {
stdio: 'pipe',
encoding: 'ascii'
stdio: ['ignore', 'pipe', 'ignore'],
encoding: 'ascii',
timeout: 1500
});
} catch (e) {
;
@ -2156,6 +2157,12 @@ Tput.prototype.GetConsoleCP = function() {
ccp = +ccp[0];
// XXX Workaround: temporarily allow unicode on cp437.
// When CP is 65001, node throws on all output!
if (ccp === 437) {
ccp = 65001;
}
return ccp;
};