Просмотр исходного кода

desktop: kill_sidecar before update install on windows

Brendan Allan 2 месяцев назад
Родитель
Сommit
c20f2731ab
2 измененных файлов с 3 добавлено и 0 удалено
  1. 1 0
      packages/desktop/src/index.tsx
  2. 2 0
      packages/desktop/src/updater.ts

+ 1 - 0
packages/desktop/src/index.tsx

@@ -83,6 +83,7 @@ const platform: Platform = {
 
   update: async () => {
     if (!UPDATER_ENABLED || !update) return
+    if(ostype() === "windows") await invoke("kill_sidecar")
     await update.install()
   },
 

+ 2 - 0
packages/desktop/src/updater.ts

@@ -2,6 +2,7 @@ import { check } from "@tauri-apps/plugin-updater"
 import { relaunch } from "@tauri-apps/plugin-process"
 import { ask, message } from "@tauri-apps/plugin-dialog"
 import { invoke } from "@tauri-apps/api/core"
+import { type as ostype } from "@tauri-apps/plugin-os"
 
 export const UPDATER_ENABLED = window.__OPENCODE__?.updaterEnabled ?? false
 
@@ -34,6 +35,7 @@ export async function runUpdater({ alertOnFail }: { alertOnFail: boolean }) {
   if (!shouldUpdate) return
 
   try {
+    if(ostype() === "windows") await invoke("kill_sidecar")
     await update.install()
   } catch {
     await message("Failed to install update", { title: "Update Failed" })