@tinycloud/operations 0.3.3 → 0.3.4-beta.1

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.
@@ -7079,9 +7079,12 @@ async function acquireProfileLock(profile, options) {
7079
7079
  const staleAfterMs = options.staleAfterMs ?? DEFAULT_STALE_LOCK_MS;
7080
7080
  const startedAt = Date.now();
7081
7081
  const lockPath = profileLockPath(profile);
7082
- await (0, import_promises.mkdir)(profilePath(profile), { recursive: true, mode: PRIVATE_DIR_MODE });
7083
- for (const directory of [tinycloudHomePath(), profilesPath(), profilePath(profile)]) {
7084
- await (0, import_promises.chmod)(directory, PRIVATE_DIR_MODE);
7082
+ const directory = profilePath(profile);
7083
+ await (0, import_promises.mkdir)(directory, { recursive: true, mode: PRIVATE_DIR_MODE });
7084
+ for (const path of [tinycloudHomePath(), profilesPath(), directory]) {
7085
+ await (0, import_promises.chmod)(path, PRIVATE_DIR_MODE).catch((error) => {
7086
+ if (path !== directory || !isErrno(error, "ENOENT")) throw error;
7087
+ });
7085
7088
  }
7086
7089
  while (true) {
7087
7090
  const token = (0, import_node_crypto.randomUUID)();
@@ -7104,7 +7107,9 @@ async function publishProfileLock(profile, lockPath, token) {
7104
7107
  await (0, import_promises.mkdir)(lockPath, { mode: PRIVATE_DIR_MODE });
7105
7108
  } catch (error) {
7106
7109
  if (isErrno(error, "EEXIST")) return false;
7107
- throw error;
7110
+ if (!isErrno(error, "ENOENT")) throw error;
7111
+ await (0, import_promises.mkdir)(profilePath(profile), { recursive: true, mode: PRIVATE_DIR_MODE });
7112
+ return false;
7108
7113
  }
7109
7114
  await waitForTestBarrier(TEST_LOCK_PUBLISH_BARRIER_DIR, profile);
7110
7115
  const staged = (0, import_node_path.join)((0, import_node_path.dirname)(lockPath), `.lock-owner-${token}.tmp`);