25 MB lightweight cross-platform database client for 100+ databases, including MySQL, PostgreSQL, SQLite, Redis, MongoDB, DuckDB, SQL Server, and Dameng. Built-in AI, MCP Server, CLI, desktop and Docker. | 轻量级跨平台数据库管理工具,支持 MySQL、PostgreSQL、SQLite、Redis、MongoDB、达梦等 100+ 数据库,提供桌面端、Docker、CLI、内置 AI 助手和 MCP。
TypeScript aicliclickhousedatabasedatabase-clientdatabase-managementdockerguimcpmongodbmysqlpostgresqlredisrustsql-serversqlitetaurivue
fix(relaunch): restart macOS through LaunchServices after updates
zipgab2ca96df237
diff --git a/Cargo.lock b/Cargo.lockindex 6d6b6c2edc..7461ef83a4 100644--- a/Cargo.lock+++ b/Cargo.lock@@ -2153,6 +2153,7 @@ dependencies = ["csv","dbx-core","dbx-mcp",+ "dbx-platform","dbx-tauri-consul","dbx-tauri-schema","deadpool-postgres",@@ -2191,7 +2192,6 @@ dependencies = ["tauri-plugin-fs","tauri-plugin-log","tauri-plugin-opener",- "tauri-plugin-process","tauri-plugin-shell","tauri-plugin-single-instance","tauri-plugin-updater",@@ -9805,16 +9805,6 @@ dependencies = ["zbus 5.18.0",]-[[package]]-name = "tauri-plugin-process"-version = "2.3.1"-source = "registry+https://github.com/rust-lang/crates.io-index"-checksum = "d55511a7bf6cd70c8767b02c97bf8134fa434daf3926cfc1be0a0f94132d165a"-dependencies = [- "tauri",- "tauri-plugin",-]-[[package]]name = "tauri-plugin-shell"version = "2.3.5"diff --git a/apps/desktop/src/components/config/DriverStoreDialog.vue b/apps/desktop/src/components/config/DriverStoreDialog.vueindex 4b37a1ecba..c9e0c9b7ec 100644--- a/apps/desktop/src/components/config/DriverStoreDialog.vue+++ b/apps/desktop/src/components/config/DriverStoreDialog.vue@@ -183,8 +183,7 @@ async function applyDriverStoreDir(kind: DriverStoreDirKind, newDir: string | nu};toast(t("driverStore.driverStoreDirSuccess", { target }));// Restart the app to use the new paths- const { relaunch } = await import("@tauri-apps/plugin-process");- relaunch();+ await api.relaunchApp();} catch (e: any) {toast(t("driverStore.driverStoreDirMigrationFailed", { error: backendError(e) }), 5000);} finally {diff --git a/apps/desktop/src/components/editor/EditorSettingsDialog.vue b/apps/desktop/src/components/editor/EditorSettingsDialog.vueindex 3c51d8c8d1..de45aa25c4 100644--- a/apps/desktop/src/components/editor/EditorSettingsDialog.vue+++ b/apps/desktop/src/components/editor/EditorSettingsDialog.vue@@ -207,6 +207,7 @@ import {webdavSyncInspect,webdavSyncSecretsStatus,webdavSyncTest,+ relaunchApp,webdavSyncUpload,listInstalledAgentsLocal,listPlugins,@@ -2649,8 +2650,7 @@ async function restartDbxForDuckDbIsolation() {duckDbRestarting.value = true;try {await persistSettings();- const { relaunch } = await import("@tauri-apps/plugin-process");- await relaunch();+ await relaunchApp();} catch (e: any) {toast(t("settings.restartDbxFailed", { error: e?.message || String(e) }), 5000);} finally {diff --git a/apps/desktop/src/composables/__tests__/useAppUpdater.spec.ts b/apps/desktop/src/composables/__tests__/useAppUpdater.spec.tsindex b056ef440d..8759493ec3 100644--- a/apps/desktop/src/composables/__tests__/useAppUpdater.spec.ts+++ b/apps/desktop/src/composables/__tests__/useAppUpdater.spec.ts@@ -12,14 +12,13 @@ const mocks = vi.hoisted(() => ({discardDownloadedUpdate: vi.fn(),getAppVersion: vi.fn(),listen: vi.fn(),- relaunch: vi.fn(),+ relaunchApp: vi.fn(),persist: vi.fn(),toast: vi.fn(),}));vi.mock("@/lib/backend/api", () => mocks);vi.mock("@/lib/backend/tauriRuntime", () => ({ isTauriRuntime: () => true }));vi.mock("@tauri-apps/api/event", () => ({ listen: mocks.listen }));-vi.mock("@tauri-apps/plugin-process", () => ({ relaunch: mocks.relaunch }));vi.mock("@/composables/useToast", () => ({ useToast: () => ({ toast: mocks.toast }) }));const settings = reactive({ updateDownloadSource: "official", ignoredUpdateVersion: "", updateNotificationsEnabled: true, autoDownloadUpdates: true, autoUpdateApp: true, toolbarItems: { checkUpdates: true } });vi.mock("@/stores/settingsStore", () => ({ useSettingsStore: () => ({ editorSettings: settings, updateEditorSettingsAndPersist: mocks.persist }) }));@@ -206,7 +205,7 @@ describe("silent update lifecycle", () => {expect(updater.showUpdateDialog.value).toBe(false);expect(mocks.toast).not.toHaveBeenCalled();expect(mocks.installDownloadedUpdate).not.toHaveBeenCalled();- expect(mocks.relaunch).not.toHaveBeenCalled();+ expect(mocks.relaunchApp).not.toHaveBeenCalled();});it("keeps the cloud icon available while downloading, and closing does not cancel", async () => {const pending = deferred<typeof cache>();@@ -233,7 +232,7 @@ describe("silent update lifecycle", () => {expect(mocks.downloadUpdate).not.toHaveBeenCalled();expect(mocks.installDownloadedUpdate).toHaveBeenCalledWith("cached", "1.1.0");expect(prepare.mock.invocationCallOrder[0]).toBeLessThan(mocks.installDownloadedUpdate.mock.invocationCallOrder[0]);- expect(mocks.installDownloadedUpdate.mock.invocationCallOrder[0]).toBeLessThan(mocks.relaunch.mock.invocationCallOrder[0]);+ expect(mocks.installDownloadedUpdate.mock.invocationCallOrder[0]).toBeLessThan(mocks.relaunchApp.mock.invocationCallOrder[0]);expect(release).not.toHaveBeenCalled();});it("preparation failure retains the package and repeated clicks cannot bypass preparation", async () => {@@ -257,13 +256,13 @@ describe("silent update lifecycle", () => {expect(mocks.installDownloadedUpdate).not.toHaveBeenCalled();});it("retries only restart after relaunch fails", async () => {- mocks.relaunch.mockRejectedValueOnce(new Error("restart failed"));+ mocks.relaunchApp.mockRejectedValueOnce(new Error("restart failed"));const updater = mount();await updater.checkUpdates({ silent: true });await updater.installDownloadedUpdate();await updater.restartApp();expect(mocks.installDownloadedUpdate).toHaveBeenCalledOnce();- expect(mocks.relaunch).toHaveBeenCalledTimes(2);+ expect(mocks.relaunchApp).toHaveBeenCalledTimes(2);});it("persists ignore before deleting a ready cache", async () => {const updater = mount();@@ -369,7 +368,7 @@ describe("silent update lifecycle", () => {await updater.installDownloadedUpdate();expect(updater.phase.value).toBe("idle");expect(updater.updateDownloaded.value).toBe(false);- expect(mocks.relaunch).not.toHaveBeenCalled();+ expect(mocks.relaunchApp).not.toHaveBeenCalled();});it("holds the preparation barrier through install and releases it only on failure", async () => {diff --git a/apps/desktop/src/composables/useAppUpdater.ts b/apps/desktop/src/composables/useAppUpdater.tsindex f84e25045b..1f8caf696e 100644--- a/apps/desktop/src/composables/useAppUpdater.ts+++ b/apps/desktop/src/composables/useAppUpdater.ts@@ -413,8 +413,7 @@ export function useAppUpdater(options: UseAppUpdaterOptions = {}) {// Windows installers and the portable helper own process replacement/relaunch.if (!cache?.portable_mode && !navigator.userAgent.includes("Windows")) {phase.value = "restart";- const { relaunch } = await import("@tauri-apps/plugin-process");- await relaunch();+ await api.relaunchApp();}} catch (error) {failed = true;diff --git a/apps/desktop/src/lib/backend/api.ts b/apps/desktop/src/lib/backend/api.tsindex fc33f828a2..0f53ad06da 100644--- a/apps/desktop/src/lib/backend/api.ts+++ b/apps/desktop/src/lib/backend/api.ts@@ -1002,6 +1002,7 @@ export const cancelUpdateDownload = forward("cancelUpdateDownload");export const getDownloadedUpdate = forward("getDownloadedUpdate");export const discardDownloadedUpdate = forward("discardDownloadedUpdate");export const installDownloadedUpdate = forward("installDownloadedUpdate");+export const relaunchApp = forward("relaunchApp");export const getAppVersion = forward("getAppVersion");export const getAppSupportInfo = forward("getAppSupportInfo");diff --git a/apps/desktop/src/lib/backend/http.ts b/apps/desktop/src/lib/backend/http.tsindex 299fd6bbb3..e0595e6749 100644--- a/apps/desktop/src/lib/backend/http.ts+++ b/apps/desktop/src/lib/backend/http.ts@@ -5679,6 +5679,10 @@ export async function installDownloadedUpdate(_cacheId: string, _expectedVersionthrow new Error("In-app update installation is only available in the desktop app.");}+export async function relaunchApp(): Promise<void> {+ throw new Error("Restarting DBX is only available in the desktop app.");+}+export async function getAppVersion(): Promise<string> {const res: { version: string } = await get("/api/version");return res.version;diff --git a/apps/desktop/src/lib/backend/tauri.ts b/apps/desktop/src/lib/backend/tauri.tsindex 110ada2f87..79ae6609b5 100644--- a/apps/desktop/src/lib/backend/tauri.ts+++ b/apps/desktop/src/lib/backend/tauri.ts@@ -3484,6 +3484,11 @@ export async function installDownloadedUpdate(cacheId: string, expectedVersion:return invoke("install_downloaded_update", { cacheId, expectedVersion });}+export async function relaunchApp(): Promise<void> {+ // macOS relaunches through LaunchServices so the new process keeps its local-network grant.+ return invoke("relaunch_app");+}+export async function getAppVersion(): Promise<string> {const { getVersion } = await import("@tauri-apps/api/app");return getVersion();diff --git a/crates/dbx-platform/src/lib.rs b/crates/dbx-platform/src/lib.rsindex 5cc469a4d6..89b99f6743 100644--- a/crates/dbx-platform/src/lib.rs+++ b/crates/dbx-platform/src/lib.rs@@ -1,6 +1,7 @@pub mod path_utils;pub mod process;pub mod proxy;+pub mod relaunch;#[cfg(feature = "host-prompts")]pub mod ssh_prompt;diff --git a/crates/dbx-platform/src/relaunch.rs b/crates/dbx-platform/src/relaunch.rsnew file mode 100644index 0000000000..7cbb69bf54--- /dev/null+++ b/crates/dbx-platform/src/relaunch.rs@@ -0,0 +1,237 @@+//! Relaunching the desktop app on macOS.+//!+//! Tauri's `process::restart` (used by `@tauri-apps/plugin-process`'s `relaunch`) spawns the+//! executable inside `Contents/MacOS` directly. During an in-app update that new process is+//! parented by the old instance, which exits right after spawning it: LaunchServices keeps the+//! old app record alive as `exited-with-subordinates` and the new process never gets its own app+//! record.+//!+//! macOS 27 resolves the local-network privacy grant through that app record. A relaunched process+//! without one cannot be matched to the app's grant, so every connection to a LAN address is+//! dropped by the kernel as `EHOSTUNREACH` ("No route to host", os error 65) while internet+//! connections keep working. Opening the bundle through LaunchServices (`open`) instead gives the+//! new process a normal app record, so the local-network permission keeps working after an update.++use std::path::{Path, PathBuf};++/// Returns the `.app` bundle that contains `executable`.+///+/// Only the `.../Foo.app/Contents/MacOS/foo` layout is accepted. A bare `target/debug/dbx`, a+/// portable executable or a test binary returns `None` and callers should fall back to the+/// platform's default restart behavior.+pub fn app_bundle_path(executable: &Path) -> Option<PathBuf> {+ let macos_dir = executable.parent()?;+ if macos_dir.file_name()? != "MacOS" {+ return None;+ }+ let contents_dir = macos_dir.parent()?;+ if contents_dir.file_name()? != "Contents" {+ return None;+ }+ let bundle = contents_dir.parent()?;+ if bundle.extension()? != "app" {+ return None;+ }+ Some(bundle.to_path_buf())+}++/// Builds the detached helper script run by [`spawn_launch_services_relaunch`].+///+/// `forwarded_env` (the caller's `DBX_*` variables) is passed to the new instance with+/// `open --env`, because LaunchServices does not inherit this process's environment.+/// `open --env` needs macOS 13+, so the helper falls back to a plain launch when that+/// option is unavailable.+#[cfg(any(target_os = "macos", test))]+fn relaunch_script(waiter_pid: u32, forwarded_env: &[(String, String)]) -> String {+ let open = if forwarded_env.is_empty() {+ "exec /usr/bin/open -n \"$1\"".to_string()+ } else {+ let env_args = forwarded_env+ .iter()+ .map(|(key, value)| format!(" --env '{}={}'", key, value.replace('\'', "'\\''")))+ .collect::<String>();+ format!("/usr/bin/open -n{env_args} \"$1\" || exec /usr/bin/open -n \"$1\"")+ };+ // Keep the shell alive for the first open so an unsupported --env option+ // can return to it and run the fallback. exec would bypass that fallback.+ format!("while /bin/kill -0 {waiter_pid} 2>/dev/null; do /bin/sleep 0.1; done; {open}")+}++/// Spawns a detached helper that waits for `waiter_pid` to exit, then opens `bundle` through+/// LaunchServices.+///+/// The helper must not open the bundle while this process is still alive: the single-instance+/// guard would hand the second launch back to the exiting process and quit, leaving the app+/// closed. Returns the helper's pid.+#[cfg(target_os = "macos")]+pub fn spawn_launch_services_relaunch(waiter_pid: u32, bundle: &Path) -> std::io::Result<u32> {+ use std::process::{Command, Stdio};++ // The previous spawn-based restart inherited the whole environment; LaunchServices+ // starts a fresh one, so forward every DBX_* override (data dir, secret key file, ...).+ let mut forwarded_env: Vec<(String, String)> = std::env::vars_os()+ .filter_map(|(key, value)| {+ let key = key.to_string_lossy().into_owned();+ let value = value.to_string_lossy().into_owned();+ (key.starts_with("DBX_") && !value.is_empty()).then_some((key, value))+ })+ .collect();+ forwarded_env.sort();+ let script = relaunch_script(waiter_pid, &forwarded_env);+ Command::new("/bin/sh")+ .arg("-c")+ .arg(script)+ .arg("dbx-relaunch")+ .arg(bundle)+ .stdin(Stdio::null())+ .stdout(Stdio::null())+ .stderr(Stdio::null())+ .spawn()+ .map(|child| child.id())+}++#[cfg(test)]+mod tests {+ use super::*;+ use std::path::Path;++ #[test]+ fn detects_app_bundle_from_bundled_executable() {+ let bundle = app_bundle_path(Path::new("/Applications/DBX.app/Contents/MacOS/dbx"));+ assert_eq!(bundle.as_deref(), Some(Path::new("/Applications/DBX.app")));+ }++ #[test]+ fn detects_app_bundle_in_build_directory() {+ let bundle =+ app_bundle_path(Path::new("/Users/staff/dbx/target/debug/bundle/macos/DBX.app/Contents/MacOS/dbx"));+ assert_eq!(bundle.as_deref(), Some(Path::new("/Users/staff/dbx/target/debug/bundle/macos/DBX.app")));+ }++ #[test]+ fn ignores_executables_outside_an_app_bundle() {+ assert_eq!(app_bundle_path(Path::new("/Users/staff/dbx/target/debug/dbx")), None);+ assert_eq!(app_bundle_path(Path::new("/Applications/DBX.app/dbx")), None);+ assert_eq!(app_bundle_path(Path::new("/Applications/DBX.app/Contents/MacOS/dbx/extra")), None);+ assert_eq!(app_bundle_path(Path::new("/Applications/DBX.app/Contents/Resources/dbx")), None);+ assert_eq!(app_bundle_path(Path::new("/Applications/DBX/Contents/MacOS/dbx")), None);+ assert_eq!(app_bundle_path(Path::new("dbx")), None);+ }++ #[test]+ fn requires_the_lowercase_dot_app_extension() {+ assert_eq!(app_bundle_path(Path::new("/Applications/DBX.app.bak/Contents/MacOS/dbx")), None);+ assert_eq!(app_bundle_path(Path::new("/Applications/DBX.App/Contents/MacOS/dbx")), None);+ }++ #[test]+ fn helper_waits_for_the_current_process_and_opens_the_bundle() {+ let script = relaunch_script(4242, &[]);+ assert!(script.starts_with("while /bin/kill -0 4242 2>/dev/null; do /bin/sleep 0.1; done; "));+ assert!(script.ends_with("exec /usr/bin/open -n \"$1\""));+ assert!(!script.contains("--env"));+ }++ #[test]+ fn helper_forwards_the_custom_data_dir_to_the_new_instance() {+ let script = relaunch_script(7, &[("DBX_DATA_DIR".to_string(), "/tmp/dbx dev/data".to_string())]);+ assert!(script.contains("--env 'DBX_DATA_DIR=/tmp/dbx dev/data'"));+ assert!(script.contains("|| exec /usr/bin/open -n \"$1\""));+ }++ #[test]+ fn helper_escapes_single_quotes_in_the_data_dir() {+ let script = relaunch_script(7, &[("DBX_DATA_DIR".to_string(), "/tmp/it's here".to_string())]);+ assert!(script.contains("--env 'DBX_DATA_DIR=/tmp/it'\\''s here'"));+ }++ #[test]+ fn helper_forwards_every_dbx_override_as_its_own_env_argument() {+ let script = relaunch_script(+ 9,+ &[+ ("DBX_DATA_DIR".to_string(), "/tmp/dbx".to_string()),+ ("DBX_SECRET_KEY_FILE".to_string(), "/tmp/key file".to_string()),+ ],+ );+ assert!(script.contains("--env 'DBX_DATA_DIR=/tmp/dbx' --env 'DBX_SECRET_KEY_FILE=/tmp/key file'"));+ }++ #[cfg(unix)]+ #[test]+ fn helper_runs_the_fallback_when_open_rejects_env() {+ // Simulate an older open rejecting --env, then observe the fallback+ // without launching an app. Execute the actual generated shell script.+ // The wait loop has its own test. Run only the launch section here:+ // Linux kill narrows u32::MAX to pid -1, which can wait indefinitely.+ let helper = relaunch_script(4242, &[("DBX_DATA_DIR".to_string(), "/tmp/dbx".to_string())]);+ let script = helper+ .split_once("; done; ")+ .unwrap()+ .1+ .replacen("/usr/bin/open", "/usr/bin/false", 1)+ .replace("/usr/bin/open", "/bin/echo");+ let output = std::process::Command::new("/bin/sh")+ .args(["-c", &script, "dbx-relaunch", "/Applications/Test App.app"])+ .output()+ .unwrap();+ assert!(output.status.success());+ assert_eq!(String::from_utf8(output.stdout).unwrap(), "/Applications/Test App.app");+ }++ /// Exercises the real helper against a throwaway bundle. Needs a macOS GUI session, so it is+ /// opt-in: `cargo test -p dbx-platform -- --ignored launches_bundle_through_launch_services`.+ #[cfg(target_os = "macos")]+ #[test]+ #[ignore = "launches a temporary .app through LaunchServices"]+ fn launches_bundle_through_launch_services() {+ use std::fs;+ use std::time::{Duration, Instant};++ let root = std::env::temp_dir().join(format!(+ "dbx-relaunch-test-{}-{}",+ std::process::id(),+ std::time::SystemTime::now().duration_since(std::time::UNIX_EPOCH).unwrap().as_nanos()+ ));+ let app = root.join("DBX Relaunch Test.app");+ let macos_dir = app.join("Contents/MacOS");+ fs::create_dir_all(&macos_dir).unwrap();+ let marker = root.join("launched.txt");+ fs::write(+ app.join("Contents/Info.plist"),+ r#"<?xml version="1.0" encoding="UTF-8"?>+<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">+<plist version="1.0"><dict>+<key>CFBundleExecutable</key><string>relaunch-test</string>+<key>CFBundleIdentifier</key><string>dev.dbx.relaunch-test</string>+<key>CFBundleName</key><string>DBX Relaunch Test</string>+<key>CFBundlePackageType</key><string>APPL</string>+<key>CFBundleShortVersionString</key><string>1.0</string>+<key>CFBundleVersion</key><string>1</string>+<key>LSUIElement</key><true/>+</dict></plist>+"#,+ )+ .unwrap();+ let executable = macos_dir.join("relaunch-test");+ fs::write(&executable, format!("#!/bin/sh\n/usr/bin/touch \"{}\"\n", marker.display())).unwrap();+ #[cfg(unix)]+ {+ use std::os::unix::fs::PermissionsExt;+ fs::set_permissions(&executable, fs::Permissions::from_mode(0o755)).unwrap();+ }++ // u32::MAX is never a live pid, so the helper opens the bundle immediately.+ spawn_launch_services_relaunch(u32::MAX, &app).unwrap();+ let deadline = Instant::now() + Duration::from_secs(15);+ while Instant::now() < deadline {+ if marker.exists() {+ let _ = fs::remove_dir_all(&root);+ return;+ }+ std::thread::sleep(Duration::from_millis(100));+ }+ let _ = fs::remove_dir_all(&root);+ panic!("LaunchServices did not start the test bundle");+ }+}diff --git a/flake.nix b/flake.nixindex 53d04725fb..65673aa26d 100644--- a/flake.nix+++ b/flake.nix@@ -203,7 +203,7 @@fetcherVersion = 4;# Update with the hash reported by a failed fixed-output build:# nix build .#dbx-pnpm-deps 2>&1 | grep 'got:'- hash = "sha256-3mlTqUtIlGuxgWnLHuvdem2VtjjEoCYkCCkqnMUJFgU=";+ hash = "sha256-hmSPmrwtcsESb14HlQSSJN7eSj+hXlAivVrJHINyGDE=";};# ── Step 2: vendor Cargo dependencies ───────────────────────────── #diff --git a/package.json b/package.jsonindex f880c21789..d7a33275e8 100644--- a/package.json+++ b/package.json@@ -77,7 +77,6 @@"@tauri-apps/plugin-clipboard-manager": "2.3.2","@tauri-apps/plugin-dialog": "2.7.1","@tauri-apps/plugin-fs": "2.5.1",- "@tauri-apps/plugin-process": "2.3.1","@tauri-apps/plugin-shell": "2.3.5","@tauri-apps/plugin-updater": "2.10.1","@uiw/codemirror-theme-duotone": "^4.25.10",diff --git a/pnpm-lock.yaml b/pnpm-lock.yamlindex 6a235eef82..490b2cf677 100644--- a/pnpm-lock.yaml+++ b/pnpm-lock.yaml@@ -90,9 +90,6 @@ importers:'@tauri-apps/plugin-fs':specifier: 2.5.1version: 2.5.1- '@tauri-apps/plugin-process':- specifier: 2.3.1- version: 2.3.1'@tauri-apps/plugin-shell':specifier: 2.3.5version: 2.3.5@@ -1687,9 +1684,6 @@ packages:'@tauri-apps/[email protected]':resolution: {integrity: sha512-9Lz+Jopp6QyeEWhlpkMx4R/+P9HgR+AVAI4vOZhlT8Xaymtz8iVI/Ov984/XTqgJz/5gz5NretqPB/XEMS3NhQ==}- '@tauri-apps/[email protected]':- resolution: {integrity: sha512-nCa4fGVaDL/B9ai03VyPOjfAHRHSBz5v6F/ObsB73r/dA3MHHhZtldaDMIc0V/pnUw9ehzr2iEG+XkSEyC0JJA==}-'@tauri-apps/[email protected]':resolution: {integrity: sha512-jewtULhiQ7lI7+owCKAjc8tYLJr92U16bPOeAa472LHJdgaibLP83NcfAF2e+wkEcA53FxKQAZ7byDzs2eeizg==}@@ -5232,10 +5226,6 @@ snapshots:dependencies:'@tauri-apps/api': 2.11.0- '@tauri-apps/[email protected]':- dependencies:- '@tauri-apps/api': 2.11.0-'@tauri-apps/[email protected]':dependencies:'@tauri-apps/api': 2.11.0diff --git a/renovate.json b/renovate.jsonindex 762a0a0074..f6bae6f6b1 100644--- a/renovate.json+++ b/renovate.json@@ -78,7 +78,6 @@"@tauri-apps/plugin-clipboard-manager","@tauri-apps/plugin-dialog","@tauri-apps/plugin-fs",- "@tauri-apps/plugin-process","@tauri-apps/plugin-shell","@tauri-apps/plugin-updater"],diff --git a/src-tauri/Cargo.toml b/src-tauri/Cargo.tomlindex a6bef62d2a..b49d05bb0c 100644--- a/src-tauri/Cargo.toml+++ b/src-tauri/Cargo.toml@@ -51,7 +51,6 @@ tauri-plugin-fs = "2.5.0"tauri-plugin-single-instance = "2.4.2"tauri-plugin-shell = "2"tauri-plugin-updater = "=2.10.1"-tauri-plugin-process = "2"tauri-plugin-window-state = "2"redis = { version = "1.7.1", features = ["tokio-comp", "tls-rustls", "tokio-rustls-comp", "cluster-async"] }rustls = { version = "0.23", features = ["aws-lc-rs"] }@@ -73,6 +72,7 @@ csv = "1.4.0"calamine = "0.30.1"zip = "4.6.1"dbx-core = { path = "../crates/dbx-core", default-features = false }+dbx-platform = { path = "../crates/dbx-platform", default-features = false }dbx-mcp = { path = "../crates/dbx-mcp", default-features = false, features = ["duckdb-sidecar", "mq-admin"] }dbx-tauri-consul = { path = "../crates/dbx-tauri-consul" }dbx-tauri-schema = { path = "../crates/dbx-tauri-schema" }diff --git a/src-tauri/capabilities/default.json b/src-tauri/capabilities/default.jsonindex 1ed6beeb50..fb79b08eb5 100644--- a/src-tauri/capabilities/default.json+++ b/src-tauri/capabilities/default.json@@ -58,7 +58,6 @@"fs:allow-read-file","fs:allow-open","fs:allow-read",- "process:default","shell:allow-open","updater:default","window-state:default"diff --git a/src-tauri/src/commands/app_relaunch.rs b/src-tauri/src/commands/app_relaunch.rsnew file mode 100644index 0000000000..8e1f0d9956--- /dev/null+++ b/src-tauri/src/commands/app_relaunch.rs@@ -0,0 +1,29 @@+/// Relaunches DBX after installing an update or after a setting change that needs a fresh process.+///+/// macOS must go through LaunchServices instead of spawning the executable directly: a directly+/// spawned process is attributed to the exiting app and never gets its own LaunchServices record,+/// which makes macOS 27 drop its LAN connections (`No route to host`, os error 65). See+/// `dbx_platform::relaunch` for the details.+#[tauri::command]+pub fn relaunch_app(app: tauri::AppHandle) {+ #[cfg(target_os = "macos")]+ {+ if let Ok(executable) = std::env::current_exe() {+ if let Some(bundle) = dbx_platform::relaunch::app_bundle_path(&executable) {+ match dbx_platform::relaunch::spawn_launch_services_relaunch(std::process::id(), &bundle) {+ Ok(helper_pid) => {+ log::info!("relaunching {} through LaunchServices (helper pid {helper_pid})", bundle.display());+ // exit(0) bypasses tauri's ExitRequested shutdown, so stop the runtime+ // resources here exactly like the updater's forced exit does.+ crate::cleanup_before_updater_forced_exit(&app);+ std::process::exit(0);+ }+ Err(error) => {+ log::warn!("failed to start the LaunchServices relaunch helper: {error}");+ }+ }+ }+ }+ }+ app.request_restart();+}diff --git a/src-tauri/src/commands/mod.rs b/src-tauri/src/commands/mod.rsindex a34a9765a7..cc8a1f3992 100644--- a/src-tauri/src/commands/mod.rs+++ b/src-tauri/src/commands/mod.rs@@ -1,6 +1,7 @@pub mod agents;pub mod ai;pub mod ai_multi_config;+pub mod app_relaunch;pub mod app_settings;pub mod background_image;pub mod cc_switch;diff --git a/src-tauri/src/lib.rs b/src-tauri/src/lib.rsindex ff38ced5af..81a3f10884 100644--- a/src-tauri/src/lib.rs+++ b/src-tauri/src/lib.rs@@ -1799,7 +1799,6 @@ pub fn run() {.plugin(tauri_plugin_opener::init()).plugin(tauri_plugin_shell::init()).plugin(tauri_plugin_updater::Builder::new().build())- .plugin(tauri_plugin_process::init()).plugin(tauri_plugin_window_state::Builder::default().with_state_flags(window_state_guard::persisted_main_window_state_flags())@@ -2906,6 +2905,7 @@ pub fn run() {commands::mcp::install_native_mcp_server,commands::mcp::uninstall_mcp_server,commands::mcp::uninstall_npm_mcp_server,+ commands::app_relaunch::relaunch_app,commands::update::check_for_updates,commands::update::fetch_changelog,commands::update::get_system_proxy_url,