fix: 错误信息显示不明确 #26

This commit is contained in:
msojocs 2022-03-08 13:41:22 +08:00
parent b8c73fd8b0
commit 4f8384e141
2 changed files with 18 additions and 3 deletions

View File

@ -172,7 +172,10 @@ if (args.includes("-llw")) {
return "\\u" + c.charCodeAt(0).toString(16).padStart(4, "0") return "\\u" + c.charCodeAt(0).toString(16).padStart(4, "0")
}) })
process.stdout.write(result) process.stdout.write(result)
}else{
process.stderr.write(Buffer.concat(errData).toString());
} }
process.exit(n)
}); });
} else if (args.includes("-lla")) { } else if (args.includes("-lla")) {
@ -233,12 +236,18 @@ if (args.includes("-llw")) {
return "\\u" + c.charCodeAt(0).toString(16).padStart(4, "0") return "\\u" + c.charCodeAt(0).toString(16).padStart(4, "0")
}) })
process.stdout.write(result) process.stdout.write(result)
}else{
process.stderr.write(Buffer.concat(errData).toString());
} }
process.exit(n)
}); });
} else { } else {
spawn(wccPath, args, { const wcc = spawn(wccPath, args, {
cwd: process.cwd(), cwd: process.cwd(),
stdio: "inherit", stdio: "inherit",
}); })
wcc.on('close', code=>{
process.exit(code)
})
} }

View File

@ -64,12 +64,18 @@ if (args.includes("-ll")) {
return "\\u" + c.charCodeAt(0).toString(16).padStart(4, "0") return "\\u" + c.charCodeAt(0).toString(16).padStart(4, "0")
}) })
process.stdout.write(result); process.stdout.write(result);
}else{
process.stderr.write(Buffer.concat(errData).toString());
} }
process.exit(n)
}); });
} else { } else {
spawn(wcscPath, args, { const wcsc = spawn(wcscPath, args, {
cwd: process.cwd(), cwd: process.cwd(),
stdio: "inherit", stdio: "inherit",
}); });
wcsc.on('close', code=>{
process.exit(code)
})
} }