panrouter 1.4.0 → 1.4.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/daemon.mjs +4 -3
- package/package.json +1 -1
package/daemon.mjs
CHANGED
|
@@ -70,14 +70,16 @@ const serverProcess = (() => {
|
|
|
70
70
|
} catch {}
|
|
71
71
|
|
|
72
72
|
log("Starting server...");
|
|
73
|
-
|
|
73
|
+
// 用 node 直接 spawn 子进程, 避免 cmd /c 的额外 shell
|
|
74
|
+
const child = spawn(process.execPath, [serverPath], {
|
|
74
75
|
cwd: appDir,
|
|
75
76
|
stdio: "ignore",
|
|
76
77
|
windowsHide: true,
|
|
78
|
+
detached: true,
|
|
77
79
|
shell: false,
|
|
78
80
|
});
|
|
79
81
|
child.unref();
|
|
80
|
-
log(`Server started
|
|
82
|
+
log(`Server started PID=${child.pid}`);
|
|
81
83
|
return child;
|
|
82
84
|
})();
|
|
83
85
|
|
|
@@ -113,7 +115,6 @@ const serverProcess = (() => {
|
|
|
113
115
|
if (evt.type === "click") {
|
|
114
116
|
if (evt.index === 2) { // 退出
|
|
115
117
|
log("Exit from PS menu");
|
|
116
|
-
try { if (serverProcess && !serverProcess.killed) serverProcess.kill(); } catch {}
|
|
117
118
|
psSend({ action: "kill" });
|
|
118
119
|
setTimeout(() => process.exit(0), 500);
|
|
119
120
|
}
|