fix(electron): port-in-use dialog shown when opening a new window

This commit is contained in:
SiriusXT 2025-11-02 20:30:01 +08:00
parent ef82c3d48b
commit f3f07cdd28

View File

@ -160,11 +160,10 @@ function startHttpServer(app: Express) {
// should simply focus on the existing window or open a new one, without displaying an error message. // should simply focus on the existing window or open a new one, without displaying an error message.
if ("code" in error && error.code === "EADDRINUSE" && (process.argv.includes("--new-window") || !app.requestSingleInstanceLock())) { if ("code" in error && error.code === "EADDRINUSE" && (process.argv.includes("--new-window") || !app.requestSingleInstanceLock())) {
console.error(message); console.error(message);
process.exit(1);
} else { } else {
dialog.showErrorBox("Error while initializing the server", message); dialog.showErrorBox("Error while initializing the server", message);
process.exit(1);
} }
process.exit(1);
}); });
} else { } else {
console.error(message); console.error(message);