GetConsoleCP fixes. see #130.
This commit is contained in:
parent
f2d809d57b
commit
cbed0b449a
11
lib/tput.js
11
lib/tput.js
|
@ -2141,8 +2141,9 @@ Tput.prototype.GetConsoleCP = function() {
|
||||||
try {
|
try {
|
||||||
// Produces something like: 'Active code page: 437\n\n'
|
// Produces something like: 'Active code page: 437\n\n'
|
||||||
ccp = cp.execFileSync(process.env.WINDIR + '\\system32\\chcp.com', [], {
|
ccp = cp.execFileSync(process.env.WINDIR + '\\system32\\chcp.com', [], {
|
||||||
stdio: 'pipe',
|
stdio: ['ignore', 'pipe', 'ignore'],
|
||||||
encoding: 'ascii'
|
encoding: 'ascii',
|
||||||
|
timeout: 1500
|
||||||
});
|
});
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
;
|
;
|
||||||
|
@ -2156,6 +2157,12 @@ Tput.prototype.GetConsoleCP = function() {
|
||||||
|
|
||||||
ccp = +ccp[0];
|
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;
|
return ccp;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue