|
@@ -123,6 +123,21 @@ const isRunning = (query: string, cb: Function) => {
|
|
}
|
|
}
|
|
);
|
|
);
|
|
};
|
|
};
|
|
|
|
+
|
|
|
|
+function watchClientIsRunning(times = 10) {
|
|
|
|
+ setTimeout(() => {
|
|
|
|
+ isRunning("client.exe", (status: boolean) => {
|
|
|
|
+ if (status) {
|
|
|
|
+ if (times > 0) {
|
|
|
|
+ watchClientIsRunning(times--);
|
|
|
|
+ }
|
|
|
|
+ } else {
|
|
|
|
+ win?.show();
|
|
|
|
+ }
|
|
|
|
+ });
|
|
|
|
+ }, 500);
|
|
|
|
+}
|
|
|
|
+
|
|
function startExe(exePath: string) {
|
|
function startExe(exePath: string) {
|
|
console.log("主进程接收到的exe路径:", exePath);
|
|
console.log("主进程接收到的exe路径:", exePath);
|
|
let checkPath = exePath.includes(".exe ")
|
|
let checkPath = exePath.includes(".exe ")
|
|
@@ -136,13 +151,7 @@ function startExe(exePath: string) {
|
|
// });
|
|
// });
|
|
exec(exePath, (error, stdout, stderr) => {
|
|
exec(exePath, (error, stdout, stderr) => {
|
|
console.log("子进程关闭了!");
|
|
console.log("子进程关闭了!");
|
|
- setTimeout(() => {
|
|
|
|
- isRunning("client.exe", (status: boolean) => {
|
|
|
|
- if (!status) {
|
|
|
|
- win?.show();
|
|
|
|
- }
|
|
|
|
- });
|
|
|
|
- }, 200);
|
|
|
|
|
|
+ watchClientIsRunning();
|
|
});
|
|
});
|
|
} else {
|
|
} else {
|
|
dialog.showErrorBox("tip", `${checkPath}不存在!`);
|
|
dialog.showErrorBox("tip", `${checkPath}不存在!`);
|