mirror of
https://github.com/zadam/trilium.git
synced 2025-06-06 18:08:33 +02:00
Merge pull request #388 from SiriusXT/electron_start_dialog
The new instance makes the dialog box error not display
This commit is contained in:
commit
891621be69
3
.vscode/settings.json
vendored
3
.vscode/settings.json
vendored
@ -14,4 +14,7 @@
|
|||||||
"[javascript]": {
|
"[javascript]": {
|
||||||
"editor.defaultFormatter": "vscode.typescript-language-features"
|
"editor.defaultFormatter": "vscode.typescript-language-features"
|
||||||
},
|
},
|
||||||
|
"[typescript]": {
|
||||||
|
"editor.defaultFormatter": "vscode.typescript-language-features"
|
||||||
|
},
|
||||||
}
|
}
|
||||||
|
11
src/www.ts
11
src/www.ts
@ -144,7 +144,16 @@ function startHttpServer() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (utils.isElectron()) {
|
if (utils.isElectron()) {
|
||||||
import("electron").then(({ dialog }) => {
|
import("electron").then(({ app, dialog }) => {
|
||||||
|
// 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,
|
||||||
|
// 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 (process.argv.includes('--new-window') || !app.requestSingleInstanceLock()) {
|
||||||
|
console.error(message);
|
||||||
|
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);
|
||||||
});
|
});
|
||||||
|
Loading…
x
Reference in New Issue
Block a user