@boxes-dev/dvb 1.0.451 → 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.
@@ -3310,6 +3310,39 @@ var waitForHealthyRuntime = async (socketPath, child, readStdout, readStderr) =>
3310
3310
  `Runtime validation timed out. ${readStderr() || readStdout()}`.trim()
3311
3311
  );
3312
3312
  };
3313
+ var waitForChildExit = async (child, readStdout, readStderr, timeoutMessage) => {
3314
+ await new Promise((resolve, reject) => {
3315
+ const timeout = setTimeout(() => {
3316
+ reject(
3317
+ new Error(`${timeoutMessage}. ${readStderr() || readStdout()}`.trim())
3318
+ );
3319
+ }, VALIDATION_TIMEOUT_MS);
3320
+ child.once("error", (error) => {
3321
+ clearTimeout(timeout);
3322
+ reject(error);
3323
+ });
3324
+ child.once("exit", (code, signal) => {
3325
+ clearTimeout(timeout);
3326
+ if (signal) {
3327
+ reject(
3328
+ new Error(
3329
+ `Runtime validation CLI exited via ${signal}. ${readStderr() || readStdout()}`.trim()
3330
+ )
3331
+ );
3332
+ return;
3333
+ }
3334
+ if (code !== 0) {
3335
+ reject(
3336
+ new Error(
3337
+ `Runtime validation CLI exited with ${String(code)}. ${readStderr() || readStdout()}`.trim()
3338
+ )
3339
+ );
3340
+ return;
3341
+ }
3342
+ resolve();
3343
+ });
3344
+ });
3345
+ };
3313
3346
  var terminateChild = async (child) => {
3314
3347
  if (child.exitCode !== null) return;
3315
3348
  child.kill("SIGTERM");
@@ -3332,12 +3365,16 @@ var validateRuntimeStage = async (stageDir, expectedVersion) => {
3332
3365
  `dvb-runtime-validate-${process.pid}-${(0, import_node_crypto2.randomUUID)().slice(0, 8)}`
3333
3366
  );
3334
3367
  const socketPath = import_node_path11.default.join(socketDir, "devboxd.sock");
3335
- const binPath = resolveRuntimeBinPath(stageDir, "dvbd");
3336
- if (!(0, import_node_fs7.existsSync)(binPath)) {
3337
- throw new Error(`Runtime stage is missing ${binPath}.`);
3368
+ const daemonBinPath = resolveRuntimeBinPath(stageDir, "dvbd");
3369
+ if (!(0, import_node_fs7.existsSync)(daemonBinPath)) {
3370
+ throw new Error(`Runtime stage is missing ${daemonBinPath}.`);
3371
+ }
3372
+ const cliBinPath = resolveRuntimeBinPath(stageDir, "dvb");
3373
+ if (!(0, import_node_fs7.existsSync)(cliBinPath)) {
3374
+ throw new Error(`Runtime stage is missing ${cliBinPath}.`);
3338
3375
  }
3339
3376
  await import_promises2.default.mkdir(socketDir, { recursive: true, mode: 448 });
3340
- const child = (0, import_node_child_process.spawn)(process.execPath, [binPath], {
3377
+ const child = (0, import_node_child_process.spawn)(process.execPath, [daemonBinPath], {
3341
3378
  env: {
3342
3379
  ...process.env,
3343
3380
  DEVBOX_SOCKET_PATH: socketPath
@@ -3358,6 +3395,27 @@ var validateRuntimeStage = async (stageDir, expectedVersion) => {
3358
3395
  `Runtime stage reported version ${validated.version}; expected ${expectedVersion}.`
3359
3396
  );
3360
3397
  }
3398
+ const cliHomeDir = import_node_path11.default.join(socketDir, "home");
3399
+ await import_promises2.default.mkdir(cliHomeDir, { recursive: true, mode: 448 });
3400
+ const cliChild = (0, import_node_child_process.spawn)(process.execPath, [cliBinPath, "--help"], {
3401
+ env: {
3402
+ ...process.env,
3403
+ HOME: cliHomeDir
3404
+ },
3405
+ stdio: ["ignore", "pipe", "pipe"]
3406
+ });
3407
+ const readCliStdout = collectStreamOutput(cliChild, "stdout");
3408
+ const readCliStderr = collectStreamOutput(cliChild, "stderr");
3409
+ try {
3410
+ await waitForChildExit(
3411
+ cliChild,
3412
+ readCliStdout,
3413
+ readCliStderr,
3414
+ "Runtime validation CLI timed out"
3415
+ );
3416
+ } finally {
3417
+ await terminateChild(cliChild);
3418
+ }
3361
3419
  } finally {
3362
3420
  await terminateChild(child);
3363
3421
  await import_promises2.default.rm(socketDir, { recursive: true, force: true });