fix(updater): check ShellExecuteW results (#3516)

* fix(updater): check `ShellExecuteW` results

* document the exit on windows
This commit is contained in:
Tony
2026-07-27 16:38:50 +08:00
committed by GitHub
parent abc903c240
commit 622f02bf21
5 changed files with 40 additions and 5 deletions
+17 -3
View File
@@ -84,7 +84,7 @@ class Update extends Resource {
this.rawJson = metadata.rawJson
}
/** Download the updater package */
/** Download the updater package. Call {@linkcode install} later to install it */
async download(
onEvent?: (progress: DownloadEvent) => void,
options?: DownloadOptions
@@ -102,7 +102,14 @@ class Update extends Resource {
this.downloadedBytes = new Resource(downloadedBytesRid)
}
/** Install downloaded updater package */
/**
* Install downloaded updater package. Must be called after {@linkcode download}.
*
* ## Platform-specific:
*
* - **Windows:** This function exits the app after launching the updater installer successfully
* - **macOS / Linux:** You need to relaunch the app to run the newly install version
*/
async install(options?: InstallOptions): Promise<void> {
if (!this.downloadedBytes) {
throw new Error('Update.install called before Update.download')
@@ -118,7 +125,14 @@ class Update extends Resource {
this.downloadedBytes = undefined
}
/** Downloads the updater package and installs it */
/**
* Downloads the updater package and installs it
*
* ## Platform-specific:
*
* - **Windows:** This function exits the app after launching the updater installer successfully
* - **macOS / Linux:** You need to relaunch the app to run the newly install version
*/
async downloadAndInstall(
onEvent?: (progress: DownloadEvent) => void,
options?: DownloadOptions & InstallOptions