@boxes-dev/dvb 1.0.450 → 1.0.457
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/bin/dvb-update.cjs +62 -4
- package/dist/bin/dvb-update.cjs.map +2 -2
- package/dist/bin/dvb.cjs +73 -7
- package/dist/bin/dvb.cjs.map +2 -2
- package/dist/bin/dvbd.cjs +73 -7
- package/dist/bin/dvbd.cjs.map +2 -2
- package/package.json +1 -1
package/dist/bin/dvb.cjs
CHANGED
|
@@ -3051,6 +3051,11 @@ var VALIDATION_TIMEOUT_MS = 5e3;
|
|
|
3051
3051
|
var UPGRADE_REQUIRED_EXIT_CODE = 86;
|
|
3052
3052
|
var UPDATER_INTERVAL_MS = 15 * 60 * 1e3;
|
|
3053
3053
|
var MAX_UPDATER_ERROR_LENGTH = 2e3;
|
|
3054
|
+
var runtimeManagerTestHooks = {
|
|
3055
|
+
ensureBundledRuntimeStaged: void 0,
|
|
3056
|
+
startBackgroundUpdater: void 0,
|
|
3057
|
+
runRuntimeChild: void 0
|
|
3058
|
+
};
|
|
3054
3059
|
var assertNodeVersion = () => {
|
|
3055
3060
|
const version = process.versions.node;
|
|
3056
3061
|
const major = Number(version.split(".")[0]);
|
|
@@ -3311,6 +3316,39 @@ var waitForHealthyRuntime = async (socketPath, child, readStdout, readStderr) =>
|
|
|
3311
3316
|
`Runtime validation timed out. ${readStderr() || readStdout()}`.trim()
|
|
3312
3317
|
);
|
|
3313
3318
|
};
|
|
3319
|
+
var waitForChildExit = async (child, readStdout, readStderr, timeoutMessage) => {
|
|
3320
|
+
await new Promise((resolve, reject) => {
|
|
3321
|
+
const timeout = setTimeout(() => {
|
|
3322
|
+
reject(
|
|
3323
|
+
new Error(`${timeoutMessage}. ${readStderr() || readStdout()}`.trim())
|
|
3324
|
+
);
|
|
3325
|
+
}, VALIDATION_TIMEOUT_MS);
|
|
3326
|
+
child.once("error", (error) => {
|
|
3327
|
+
clearTimeout(timeout);
|
|
3328
|
+
reject(error);
|
|
3329
|
+
});
|
|
3330
|
+
child.once("exit", (code, signal) => {
|
|
3331
|
+
clearTimeout(timeout);
|
|
3332
|
+
if (signal) {
|
|
3333
|
+
reject(
|
|
3334
|
+
new Error(
|
|
3335
|
+
`Runtime validation CLI exited via ${signal}. ${readStderr() || readStdout()}`.trim()
|
|
3336
|
+
)
|
|
3337
|
+
);
|
|
3338
|
+
return;
|
|
3339
|
+
}
|
|
3340
|
+
if (code !== 0) {
|
|
3341
|
+
reject(
|
|
3342
|
+
new Error(
|
|
3343
|
+
`Runtime validation CLI exited with ${String(code)}. ${readStderr() || readStdout()}`.trim()
|
|
3344
|
+
)
|
|
3345
|
+
);
|
|
3346
|
+
return;
|
|
3347
|
+
}
|
|
3348
|
+
resolve();
|
|
3349
|
+
});
|
|
3350
|
+
});
|
|
3351
|
+
};
|
|
3314
3352
|
var terminateChild = async (child) => {
|
|
3315
3353
|
if (child.exitCode !== null) return;
|
|
3316
3354
|
child.kill("SIGTERM");
|
|
@@ -3333,12 +3371,16 @@ var validateRuntimeStage = async (stageDir, expectedVersion) => {
|
|
|
3333
3371
|
`dvb-runtime-validate-${process.pid}-${(0, import_node_crypto2.randomUUID)().slice(0, 8)}`
|
|
3334
3372
|
);
|
|
3335
3373
|
const socketPath = import_node_path11.default.join(socketDir, "devboxd.sock");
|
|
3336
|
-
const
|
|
3337
|
-
if (!(0, import_node_fs7.existsSync)(
|
|
3338
|
-
throw new Error(`Runtime stage is missing ${
|
|
3374
|
+
const daemonBinPath = resolveRuntimeBinPath(stageDir, "dvbd");
|
|
3375
|
+
if (!(0, import_node_fs7.existsSync)(daemonBinPath)) {
|
|
3376
|
+
throw new Error(`Runtime stage is missing ${daemonBinPath}.`);
|
|
3377
|
+
}
|
|
3378
|
+
const cliBinPath = resolveRuntimeBinPath(stageDir, "dvb");
|
|
3379
|
+
if (!(0, import_node_fs7.existsSync)(cliBinPath)) {
|
|
3380
|
+
throw new Error(`Runtime stage is missing ${cliBinPath}.`);
|
|
3339
3381
|
}
|
|
3340
3382
|
await import_promises2.default.mkdir(socketDir, { recursive: true, mode: 448 });
|
|
3341
|
-
const child = (0, import_node_child_process.spawn)(process.execPath, [
|
|
3383
|
+
const child = (0, import_node_child_process.spawn)(process.execPath, [daemonBinPath], {
|
|
3342
3384
|
env: {
|
|
3343
3385
|
...process.env,
|
|
3344
3386
|
DEVBOX_SOCKET_PATH: socketPath
|
|
@@ -3359,6 +3401,27 @@ var validateRuntimeStage = async (stageDir, expectedVersion) => {
|
|
|
3359
3401
|
`Runtime stage reported version ${validated.version}; expected ${expectedVersion}.`
|
|
3360
3402
|
);
|
|
3361
3403
|
}
|
|
3404
|
+
const cliHomeDir = import_node_path11.default.join(socketDir, "home");
|
|
3405
|
+
await import_promises2.default.mkdir(cliHomeDir, { recursive: true, mode: 448 });
|
|
3406
|
+
const cliChild = (0, import_node_child_process.spawn)(process.execPath, [cliBinPath, "--help"], {
|
|
3407
|
+
env: {
|
|
3408
|
+
...process.env,
|
|
3409
|
+
HOME: cliHomeDir
|
|
3410
|
+
},
|
|
3411
|
+
stdio: ["ignore", "pipe", "pipe"]
|
|
3412
|
+
});
|
|
3413
|
+
const readCliStdout = collectStreamOutput(cliChild, "stdout");
|
|
3414
|
+
const readCliStderr = collectStreamOutput(cliChild, "stderr");
|
|
3415
|
+
try {
|
|
3416
|
+
await waitForChildExit(
|
|
3417
|
+
cliChild,
|
|
3418
|
+
readCliStdout,
|
|
3419
|
+
readCliStderr,
|
|
3420
|
+
"Runtime validation CLI timed out"
|
|
3421
|
+
);
|
|
3422
|
+
} finally {
|
|
3423
|
+
await terminateChild(cliChild);
|
|
3424
|
+
}
|
|
3362
3425
|
} finally {
|
|
3363
3426
|
await terminateChild(child);
|
|
3364
3427
|
await import_promises2.default.rm(socketDir, { recursive: true, force: true });
|
|
@@ -3573,9 +3636,12 @@ var startBackgroundUpdater = async (homeDir = import_node_os2.default.homedir())
|
|
|
3573
3636
|
var launchRuntime = async (kind, args) => {
|
|
3574
3637
|
assertNodeVersion();
|
|
3575
3638
|
const homeDir = process.env.HOME?.trim() || import_node_os2.default.homedir();
|
|
3576
|
-
|
|
3639
|
+
const ensureBundledRuntimeStagedFn = runtimeManagerTestHooks.ensureBundledRuntimeStaged ?? ensureBundledRuntimeStaged;
|
|
3640
|
+
const startBackgroundUpdaterFn = runtimeManagerTestHooks.startBackgroundUpdater ?? startBackgroundUpdater;
|
|
3641
|
+
const runRuntimeChildFn = runtimeManagerTestHooks.runRuntimeChild ?? runRuntimeChild;
|
|
3642
|
+
let runtime = await ensureBundledRuntimeStagedFn(homeDir);
|
|
3643
|
+
void startBackgroundUpdaterFn(homeDir).catch(() => {
|
|
3577
3644
|
});
|
|
3578
|
-
let runtime = await ensureBundledRuntimeStaged(homeDir);
|
|
3579
3645
|
const signalPath = import_node_path11.default.join(
|
|
3580
3646
|
await ensureUpdaterDir(homeDir),
|
|
3581
3647
|
`upgrade-required-${kind}-${process.pid}-${Date.now()}.json`
|
|
@@ -3583,7 +3649,7 @@ var launchRuntime = async (kind, args) => {
|
|
|
3583
3649
|
try {
|
|
3584
3650
|
for (let attempt = 0; attempt < 2; attempt += 1) {
|
|
3585
3651
|
await import_promises2.default.rm(signalPath, { force: true });
|
|
3586
|
-
const result = await
|
|
3652
|
+
const result = await runRuntimeChildFn(
|
|
3587
3653
|
resolveRuntimeBinPath(runtime.runtimeDir, kind),
|
|
3588
3654
|
args,
|
|
3589
3655
|
signalPath
|