mirror of
https://github.com/zadam/trilium.git
synced 2025-11-08 14:25:51 +01:00
fix(electron): port-in-use dialog shown when opening a new window | (#7595)
This commit is contained in:
@@ -158,13 +158,11 @@ function startHttpServer(app: Express) {
|
|||||||
// Not all situations require showing an error dialog. When Trilium is already open,
|
// Not all situations require showing an error dialog. When Trilium is already open,
|
||||||
// clicking the shortcut, the software icon, or the taskbar icon, or when creating a new window,
|
// clicking the shortcut, the software icon, or the taskbar icon, or when creating a new window,
|
||||||
// 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") {
|
if ("code" in error && error.code === "EADDRINUSE" && (process.argv.includes("--new-window") || !app.requestSingleInstanceLock())) {
|
||||||
if (process.argv.includes("--new-window") || !app.requestSingleInstanceLock()) {
|
console.error(message);
|
||||||
console.error(message);
|
} else {
|
||||||
process.exit(1);
|
dialog.showErrorBox("Error while initializing the server", message);
|
||||||
}
|
|
||||||
}
|
}
|
||||||
dialog.showErrorBox("Error while initializing the server", message);
|
|
||||||
process.exit(1);
|
process.exit(1);
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
|
|||||||
Reference in New Issue
Block a user