electrobun 1.18.0 → 1.18.1-beta.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -10,7 +10,7 @@ import {
10
10
  } from "fs";
11
11
  import { execSync } from "child_process";
12
12
  import { OS as currentOS, ARCH as currentArch } from "../../shared/platform";
13
- import { getPlatformPrefix, getTarballFileName, getAppFileName } from "../../shared/naming";
13
+ import { getPlatformPrefix, getTarballFileName } from "../../shared/naming";
14
14
  import { quit } from "./Utils";
15
15
 
16
16
  // Update status types for granular progress tracking
@@ -853,10 +853,11 @@ const Updater = {
853
853
  return;
854
854
  }
855
855
  } else if (currentOS === "win") {
856
- // On Windows, the actual app is inside a subdirectory
857
- // Use same naming logic as CLI and extractor
858
- const appBundleName = getAppFileName(localInfo.name, localInfo.channel);
859
- newAppBundlePath = join(extractionDir, appBundleName);
856
+ // On Windows, the actual app is inside a subdirectory.
857
+ // version.json's `name` field already contains the formatted app
858
+ // file name (e.g. "MyApp-canary" for non-stable, "MyApp" for stable),
859
+ // so don't re-apply getAppFileName or it doubles the channel suffix.
860
+ newAppBundlePath = join(extractionDir, localInfo.name);
860
861
 
861
862
  // Verify the extracted app exists
862
863
  if (!statSync(newAppBundlePath, { throwIfNoEntry: false })) {
@@ -962,32 +963,57 @@ const Updater = {
962
963
  const launcherPathWin = launcherPath.replace(/\//g, "\\");
963
964
 
964
965
  // Create a batch script that will:
965
- // 1. Wait for the current app to exit
966
- // 2. Remove current app folder
967
- // 3. Move new app to current location
966
+ // 1. Wait for the current app and its helper processes to exit
967
+ // 2. Remove current app folder (with retries — CEF helpers may briefly
968
+ // keep libcef.dll locked after launcher.exe exits)
969
+ // 3. Move new app to current location (only if old folder is fully gone,
970
+ // otherwise `move` would put it inside as a subdirectory)
968
971
  // 4. Launch the new app
969
972
  // 5. Clean up
970
973
  const updateScript = `@echo off
971
974
  setlocal
972
975
 
973
- :: Wait for the app to fully exit (check if launcher.exe is still running)
976
+ :: Wait for the app and any CEF helper processes to fully exit.
977
+ :: launcher.exe spawns bun.exe which spawns "bun Helper*.exe" processes that
978
+ :: keep libcef.dll locked; if we proceed too early, rmdir partially fails.
974
979
  :waitloop
975
- tasklist /FI "IMAGENAME eq launcher.exe" 2>NUL | find /I /N "launcher.exe">NUL
976
- if "%ERRORLEVEL%"=="0" (
977
- timeout /t 1 /nobreak >nul
978
- goto waitloop
979
- )
980
+ tasklist /FI "IMAGENAME eq launcher.exe" 2>NUL | find /I /N "launcher.exe">NUL && goto waitsleep
981
+ tasklist /FI "IMAGENAME eq bun.exe" 2>NUL | find /I /N "bun.exe">NUL && goto waitsleep
982
+ tasklist /FI "IMAGENAME eq bun Helper.exe" 2>NUL | find /I /N "bun Helper.exe">NUL && goto waitsleep
983
+ tasklist 2>NUL | find /I "bun Helper">NUL && goto waitsleep
984
+ goto waitdone
985
+ :waitsleep
986
+ timeout /t 1 /nobreak >nul
987
+ goto waitloop
988
+ :waitdone
980
989
 
981
990
  :: Small extra delay to ensure all file handles are released
982
991
  timeout /t 2 /nobreak >nul
983
992
 
984
- :: Remove current app folder
985
- if exist "${runningAppWin}" (
986
- rmdir /s /q "${runningAppWin}"
987
- )
988
-
989
- :: Move new app to current location
993
+ :: Remove current app folder, retrying if rmdir fails (locked files etc.)
994
+ set rmRetry=0
995
+ :rmloop
996
+ if not exist "${runningAppWin}" goto rmdone
997
+ rmdir /s /q "${runningAppWin}" 2>nul
998
+ if not exist "${runningAppWin}" goto rmdone
999
+ set /a rmRetry=rmRetry+1
1000
+ if %rmRetry% GEQ 10 goto rmfailed
1001
+ timeout /t 2 /nobreak >nul
1002
+ goto rmloop
1003
+ :rmfailed
1004
+ echo Update failed: could not remove "${runningAppWin}" after retries.
1005
+ echo Files may still be locked by a helper process.
1006
+ pause
1007
+ exit /b 1
1008
+ :rmdone
1009
+
1010
+ :: Move new app to current location (safe now that destination is gone)
990
1011
  move "${newAppWin}" "${runningAppWin}"
1012
+ if not exist "${launcherPathWin}" (
1013
+ echo Update failed: launcher not found at "${launcherPathWin}" after move.
1014
+ pause
1015
+ exit /b 1
1016
+ )
991
1017
 
992
1018
  :: Clean up extraction directory
993
1019
  rmdir /s /q "${extractionDirWin}" 2>nul
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "electrobun",
3
- "version": "1.18.0",
3
+ "version": "1.18.1-beta.0",
4
4
  "description": "Build ultra fast, tiny, and cross-platform desktop apps with Typescript.",
5
5
  "license": "MIT",
6
6
  "author": "Blackboard Technologies Inc.",