|
@@ -9,19 +9,29 @@ export default function async(exeName, cb) {
|
|
"不在Electron中,调用 " + exeName + " 失败",
|
|
"不在Electron中,调用 " + exeName + " 失败",
|
|
]);
|
|
]);
|
|
createLog({
|
|
createLog({
|
|
- page: window.location.pathname.replace(/\d+/g, ""),
|
|
|
|
|
|
+ page: window.location.pathname,
|
|
action: "不在Electron中,调用 " + exeName + " 失败",
|
|
action: "不在Electron中,调用 " + exeName + " 失败",
|
|
});
|
|
});
|
|
throw new Error("不在Electron中,调用 " + exeName + " 失败");
|
|
throw new Error("不在Electron中,调用 " + exeName + " 失败");
|
|
}
|
|
}
|
|
return new Promise(resolve => {
|
|
return new Promise(resolve => {
|
|
window.nodeRequire("node-cmd").get(exeName, async (err, data, stderr) => {
|
|
window.nodeRequire("node-cmd").get(exeName, async (err, data, stderr) => {
|
|
- console.log("exe", err, data, stderr); // 未免过多日志,此处后续可以关闭
|
|
|
|
|
|
+ let stderrConverted;
|
|
|
|
+ try {
|
|
|
|
+ const iconv = require("iconv-lite");
|
|
|
|
+ stderrConverted = iconv.decode(stderr, "cp936");
|
|
|
|
+ } catch (error) {
|
|
|
|
+ console.log("convert failed", error);
|
|
|
|
+ stderrConverted = "convert failed";
|
|
|
|
+ }
|
|
|
|
+ console.log(exeName, err, data, stderrConverted); // 未免过多日志,此处后续可以关闭
|
|
createLog({
|
|
createLog({
|
|
- page: window.location.pathname.replace(/\d+/g, ""),
|
|
|
|
|
|
+ page: window.location.pathname,
|
|
|
|
+ exeName,
|
|
error: JSON.stringify(err),
|
|
error: JSON.stringify(err),
|
|
data,
|
|
data,
|
|
stderr: JSON.stringify(stderr),
|
|
stderr: JSON.stringify(stderr),
|
|
|
|
+ stderrConverted: JSON.stringify(stderrConverted),
|
|
});
|
|
});
|
|
await new Promise(resolve2 => setTimeout(() => resolve2(), 1000));
|
|
await new Promise(resolve2 => setTimeout(() => resolve2(), 1000));
|
|
await cb();
|
|
await cb();
|
|
@@ -39,7 +49,7 @@ export function fileExists(file) {
|
|
"不在Electron中,调用 fs 失败",
|
|
"不在Electron中,调用 fs 失败",
|
|
]);
|
|
]);
|
|
createLog({
|
|
createLog({
|
|
- page: window.location.pathname.replace(/\d+/g, ""),
|
|
|
|
|
|
+ page: window.location.pathname,
|
|
action: "不在Electron中,调用 fs 失败",
|
|
action: "不在Electron中,调用 fs 失败",
|
|
});
|
|
});
|
|
throw new Error("不在Electron中,调用 fs 失败");
|
|
throw new Error("不在Electron中,调用 fs 失败");
|