|
@@ -1,6 +1,6 @@
|
|
|
import { createLog } from "@/utils/logger";
|
|
|
|
|
|
-export default function async(exeName, cb) {
|
|
|
+export default function checkRemote(exeName, cb) {
|
|
|
if (typeof nodeRequire == "undefined") {
|
|
|
console.log("nodeRequire failed");
|
|
|
window._hmt.push([
|
|
@@ -35,7 +35,7 @@ export default function async(exeName, cb) {
|
|
|
absPath: exeName.includes(":"),
|
|
|
});
|
|
|
// 如果相对路径没找到,则通过绝对路径来执行
|
|
|
- if (!exeName.includes(":")) {
|
|
|
+ if (!exeName.includes(":") && err) {
|
|
|
const fs = window.nodeRequire("electron").remote.require("fs");
|
|
|
|
|
|
const path = window.nodeRequire("electron").remote.require("path");
|
|
@@ -48,15 +48,20 @@ export default function async(exeName, cb) {
|
|
|
);
|
|
|
if (fs.existsSync(absPath)) {
|
|
|
try {
|
|
|
- await async([absPath, exeParams].join(" ").trim());
|
|
|
+ await checkRemote([absPath, exeParams].join(" ").trim(), cb);
|
|
|
} catch (error) {
|
|
|
console.log("second try error", absPath);
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
await new Promise((resolve2) => setTimeout(() => resolve2(), 1000));
|
|
|
- await cb();
|
|
|
- resolve();
|
|
|
+ try {
|
|
|
+ await cb();
|
|
|
+ } catch (e) {
|
|
|
+ console.log("call cb failed", e);
|
|
|
+ } finally {
|
|
|
+ resolve();
|
|
|
+ }
|
|
|
});
|
|
|
});
|
|
|
}
|
|
@@ -77,3 +82,20 @@ export function fileExists(file) {
|
|
|
}
|
|
|
return window.nodeRequire("fs").existsSync(file);
|
|
|
}
|
|
|
+
|
|
|
+export function nodeCheckRemoteDesktop() {
|
|
|
+ createLog({
|
|
|
+ page: window.location.pathname,
|
|
|
+ action: "nodeCheckRemoteDesktop",
|
|
|
+ });
|
|
|
+
|
|
|
+ const appList = window
|
|
|
+ .nodeRequire("child_process")
|
|
|
+ .execSync("tasklist")
|
|
|
+ .toString();
|
|
|
+ if (appList && appList.match(/sunloginclient/gi).length > 0) {
|
|
|
+ return true;
|
|
|
+ } else {
|
|
|
+ return false;
|
|
|
+ }
|
|
|
+}
|