π End-to-end encrypted cloud for everything.
Dart 2faandroidauthye2eeencryptionend-to-end-encryptionfluttergolanggoogle-photosgoogle-photos-alternativeiosopensourcephotosprivacyprivacy-toolstypescriptzero-knowledge
[desktop] Fix View logs hanging on Linux
aswinpradeepc1a0d75844f8f
diff --git a/desktop/changes/view-logs-linux.md b/desktop/changes/view-logs-linux.mdnew file mode 100644index 0000000000..254625a87b--- /dev/null+++ b/desktop/changes/view-logs-linux.md@@ -0,0 +1 @@+- Fixed the "View logs" button hanging on Linux instead of dismissing once the file manager opened.diff --git a/desktop/src/main/services/dir.ts b/desktop/src/main/services/dir.tsindex bf44a10c29..f1aa9753fd 100644--- a/desktop/src/main/services/dir.ts+++ b/desktop/src/main/services/dir.ts@@ -1,5 +1,6 @@import { shell } from "electron/common";import { app, dialog } from "electron/main";+import { existsSync } from "node:fs";import path from "node:path";import { posixPath } from "../utils/electron";@@ -13,7 +14,19 @@ export const selectDirectory = async () => {export const openDirectory = async (dirPath: string) => {// shell.openPath requires native separators, not our POSIX IPC paths.- const res = await shell.openPath(path.normalize(dirPath));+ const nativePath = path.normalize(dirPath);++ // On Linux shell.openPath launches xdg-open without waiting for it, and+ // drops the callback that'd settle the promise it returned (see OpenPath in+ // Electron's platform_util_linux.cc). Awaiting it would hang this handler.+ if (process.platform == "linux") {+ if (!existsSync(nativePath))+ throw new Error(`Failed to open directory ${dirPath}`);+ void shell.openPath(nativePath);+ return;+ }++ const res = await shell.openPath(nativePath);// Electron resolves with an error message on failure.if (res) throw new Error(`Failed to open directory ${dirPath}: ${res}`);};