electrobun 1.2.2-beta.1 → 1.2.2-beta.2
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.
- package/dist/api/bun/core/Updater.ts +34 -4
- package/package.json +1 -1
|
@@ -321,14 +321,40 @@ const Updater = {
|
|
|
321
321
|
);
|
|
322
322
|
|
|
323
323
|
const bunBinDir = dirname(process.execPath);
|
|
324
|
-
const
|
|
324
|
+
const bspatchBinName = currentOS === 'win' ? 'bspatch.exe' : 'bspatch';
|
|
325
|
+
const bspatchPath = join(bunBinDir, bspatchBinName);
|
|
325
326
|
|
|
326
327
|
emitStatus('applying-patch', `Applying patch ${patchesApplied + 1} for ${currentHash.slice(0, 8)}...`, {
|
|
327
328
|
currentHash,
|
|
328
329
|
patchNumber: patchesApplied + 1,
|
|
329
330
|
});
|
|
330
331
|
|
|
331
|
-
//
|
|
332
|
+
// Verify all files exist before invoking bspatch
|
|
333
|
+
if (!statSync(bspatchPath, { throwIfNoEntry: false })) {
|
|
334
|
+
emitStatus('patch-failed', `bspatch binary not found at ${bspatchPath}`, {
|
|
335
|
+
currentHash,
|
|
336
|
+
errorMessage: `bspatch not found: ${bspatchPath}`,
|
|
337
|
+
});
|
|
338
|
+
console.error("bspatch not found:", bspatchPath);
|
|
339
|
+
break;
|
|
340
|
+
}
|
|
341
|
+
if (!statSync(currentTarPath, { throwIfNoEntry: false })) {
|
|
342
|
+
emitStatus('patch-failed', `Old tar not found at ${currentTarPath}`, {
|
|
343
|
+
currentHash,
|
|
344
|
+
errorMessage: `old tar not found: ${currentTarPath}`,
|
|
345
|
+
});
|
|
346
|
+
console.error("old tar not found:", currentTarPath);
|
|
347
|
+
break;
|
|
348
|
+
}
|
|
349
|
+
if (!statSync(patchFilePath, { throwIfNoEntry: false })) {
|
|
350
|
+
emitStatus('patch-failed', `Patch file not found at ${patchFilePath}`, {
|
|
351
|
+
currentHash,
|
|
352
|
+
errorMessage: `patch not found: ${patchFilePath}`,
|
|
353
|
+
});
|
|
354
|
+
console.error("patch file not found:", patchFilePath);
|
|
355
|
+
break;
|
|
356
|
+
}
|
|
357
|
+
|
|
332
358
|
try {
|
|
333
359
|
const patchResult = Bun.spawnSync([
|
|
334
360
|
bspatchPath,
|
|
@@ -343,7 +369,7 @@ const Updater = {
|
|
|
343
369
|
if (updateInfo) {
|
|
344
370
|
updateInfo.error = stderr || `bspatch failed with exit code ${patchResult.exitCode}`;
|
|
345
371
|
}
|
|
346
|
-
emitStatus('patch-failed', `Patch application failed: ${stderr ||
|
|
372
|
+
emitStatus('patch-failed', `Patch application failed: ${stderr || `exit code ${patchResult.exitCode}`}`, {
|
|
347
373
|
currentHash,
|
|
348
374
|
errorMessage: stderr || `exit code ${patchResult.exitCode}`,
|
|
349
375
|
});
|
|
@@ -353,6 +379,10 @@ const Updater = {
|
|
|
353
379
|
exitCode: patchResult.exitCode,
|
|
354
380
|
stdout,
|
|
355
381
|
stderr,
|
|
382
|
+
bspatchPath,
|
|
383
|
+
oldTar: currentTarPath,
|
|
384
|
+
newTar: tmpPatchedTarFilePath,
|
|
385
|
+
patch: patchFilePath,
|
|
356
386
|
},
|
|
357
387
|
);
|
|
358
388
|
break;
|
|
@@ -362,7 +392,7 @@ const Updater = {
|
|
|
362
392
|
currentHash,
|
|
363
393
|
errorMessage: (error as Error).message,
|
|
364
394
|
});
|
|
365
|
-
console.error("bspatch threw", error);
|
|
395
|
+
console.error("bspatch threw", error, { bspatchPath });
|
|
366
396
|
break;
|
|
367
397
|
}
|
|
368
398
|
|
package/package.json
CHANGED