@tinycloud/operations 0.3.4-beta.0 → 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.
@@ -7234,9 +7234,12 @@ async function acquireProfileLock(profile, options) {
7234
7234
  const staleAfterMs = options.staleAfterMs ?? DEFAULT_STALE_LOCK_MS;
7235
7235
  const startedAt = Date.now();
7236
7236
  const lockPath = profileLockPath(profile);
7237
- await mkdir(profilePath(profile), { recursive: true, mode: PRIVATE_DIR_MODE });
7238
- for (const directory of [tinycloudHomePath(), profilesPath(), profilePath(profile)]) {
7239
- await chmod(directory, PRIVATE_DIR_MODE);
7237
+ const directory = profilePath(profile);
7238
+ await mkdir(directory, { recursive: true, mode: PRIVATE_DIR_MODE });
7239
+ for (const path of [tinycloudHomePath(), profilesPath(), directory]) {
7240
+ await chmod(path, PRIVATE_DIR_MODE).catch((error) => {
7241
+ if (path !== directory || !isErrno(error, "ENOENT")) throw error;
7242
+ });
7240
7243
  }
7241
7244
  while (true) {
7242
7245
  const token = randomUUID();
@@ -7259,7 +7262,9 @@ async function publishProfileLock(profile, lockPath, token) {
7259
7262
  await mkdir(lockPath, { mode: PRIVATE_DIR_MODE });
7260
7263
  } catch (error) {
7261
7264
  if (isErrno(error, "EEXIST")) return false;
7262
- throw error;
7265
+ if (!isErrno(error, "ENOENT")) throw error;
7266
+ await mkdir(profilePath(profile), { recursive: true, mode: PRIVATE_DIR_MODE });
7267
+ return false;
7263
7268
  }
7264
7269
  await waitForTestBarrier(TEST_LOCK_PUBLISH_BARRIER_DIR, profile);
7265
7270
  const staged = join(dirname(lockPath), `.lock-owner-${token}.tmp`);