mirror of
https://github.com/fofolee/uTools-quickcommand.git
synced 2025-06-08 14:34:13 +08:00
修复中文乱码
This commit is contained in:
parent
aeeddf5d17
commit
66b1e31e06
@ -175,7 +175,7 @@ run = async (cmd, option, codec, callback) => {
|
|||||||
ext = option.ext;
|
ext = option.ext;
|
||||||
cmd = await special(cmd);
|
cmd = await special(cmd);
|
||||||
let script = path.join(tmp, `QuickCommandTempScript.${ext}`)
|
let script = path.join(tmp, `QuickCommandTempScript.${ext}`)
|
||||||
if (ext == 'bat' || ext == 'ps1') cmd = iconv.encode(cmd, 'cp936');
|
// if (ext == 'bat' || ext == 'ps1') cmd = iconv.encode(cmd, 'cp936');
|
||||||
fs.writeFileSync(script, cmd);
|
fs.writeFileSync(script, cmd);
|
||||||
var argvs = [script]
|
var argvs = [script]
|
||||||
if (argv) {
|
if (argv) {
|
||||||
@ -190,10 +190,10 @@ run = async (cmd, option, codec, callback) => {
|
|||||||
var chunks = [],
|
var chunks = [],
|
||||||
err_chunks = [];
|
err_chunks = [];
|
||||||
child.stdout.on('data', chunk => {
|
child.stdout.on('data', chunk => {
|
||||||
chunks.push(iconv.decode(chunk, jschardet.detect(chunk).encoding))
|
chunks.push(chunk)
|
||||||
})
|
})
|
||||||
child.stderr.on('data', err_chunk => {
|
child.stderr.on('data', err_chunk => {
|
||||||
err_chunks.push(iconv.decode(err_chunk, jschardet.detect(err_chunk).encoding))
|
err_chunks.push(err_chunk)
|
||||||
})
|
})
|
||||||
child.on('close', code => {
|
child.on('close', code => {
|
||||||
let stdout = chunks.join("");
|
let stdout = chunks.join("");
|
||||||
|
Loading…
x
Reference in New Issue
Block a user