@getmonoceros/workbench 1.36.6 → 1.36.8

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.js CHANGED
@@ -6732,7 +6732,14 @@ function wrapExec(command, opts) {
6732
6732
  }
6733
6733
  function openInBrowser(url) {
6734
6734
  const platform = process.platform;
6735
- const [cmd, args] = platform === "darwin" ? ["open", [url]] : platform === "win32" ? ["cmd", ["/c", "start", "", url]] : ["xdg-open", [url]];
6735
+ const wsl = platform === "linux" && (!!process.env.WSL_DISTRO_NAME || (() => {
6736
+ try {
6737
+ return readFileSync5("/proc/sys/kernel/osrelease", "utf8").toLowerCase().includes("microsoft");
6738
+ } catch {
6739
+ return false;
6740
+ }
6741
+ })());
6742
+ const [cmd, args] = platform === "darwin" ? ["open", [url]] : platform === "win32" || wsl ? ["cmd.exe", ["/c", "start", "", url]] : ["xdg-open", [url]];
6736
6743
  try {
6737
6744
  const child = spawn5(cmd, args, {
6738
6745
  stdio: "ignore",
@@ -8872,7 +8879,7 @@ var CLI_VERSION;
8872
8879
  var init_version = __esm({
8873
8880
  "src/version.ts"() {
8874
8881
  "use strict";
8875
- CLI_VERSION = true ? "1.36.6" : "dev";
8882
+ CLI_VERSION = true ? "1.36.8" : "dev";
8876
8883
  }
8877
8884
  });
8878
8885
 
@@ -11362,9 +11369,36 @@ async function runRemove(opts) {
11362
11369
  await fs18.copyFile(envPath, path29.join(backupPath, `${opts.name}.env`));
11363
11370
  }
11364
11371
  if (hasContainer) {
11365
- await fs18.cp(containerPath, path29.join(backupPath, "container"), {
11366
- recursive: true
11367
- });
11372
+ const dst = path29.join(backupPath, "container");
11373
+ try {
11374
+ await fs18.cp(containerPath, dst, { recursive: true });
11375
+ } catch (err) {
11376
+ const code = err.code;
11377
+ if (code !== "EACCES" && code !== "EPERM") {
11378
+ throw err;
11379
+ }
11380
+ logger.info(
11381
+ `[remove] backup hit ${code} on root-owned files; copying via a throw-away alpine container\u2026`
11382
+ );
11383
+ await fs18.mkdir(dst, { recursive: true });
11384
+ const { exitCode, stderr } = await dockerExec([
11385
+ "run",
11386
+ "--rm",
11387
+ "-v",
11388
+ `${containerPath}:/src:ro`,
11389
+ "-v",
11390
+ `${dst}:/dst`,
11391
+ "alpine:3.21",
11392
+ "sh",
11393
+ "-c",
11394
+ "cp -a /src/. /dst/"
11395
+ ]);
11396
+ if (exitCode !== 0) {
11397
+ throw new Error(
11398
+ `docker-based backup of ${containerPath} failed (exit ${exitCode}${stderr.trim() ? `: ${stderr.trim()}` : ""}).`
11399
+ );
11400
+ }
11401
+ }
11368
11402
  }
11369
11403
  logger.info(`Backup written to ${prettyPath(backupPath)}.`);
11370
11404
  }