MCPcopy Index your code
hub / github.com/getsentry/XcodeBuildMCP / createLock

Function createLock

src/utils/fs-lock-sync.ts:103–125  ·  view source on GitHub ↗
(lockDir: string, owner: FsLockOwner)

Source from the content-addressed store, hash-verified

101}
102
103function createLock(lockDir: string, owner: FsLockOwner): AcquiredFsLockSync {
104 mkdirSync(lockDir, { mode: 0o700 });
105 try {
106 writeFileSync(join(lockDir, FS_LOCK_OWNER_FILE), `${JSON.stringify(owner)}\n`, {
107 encoding: 'utf8',
108 mode: 0o600,
109 });
110 } catch (error) {
111 rmSync(lockDir, { recursive: true, force: true });
112 throw error;
113 }
114
115 return {
116 owner,
117 release(): void {
118 const currentOwner = readLockOwnerSync(lockDir);
119 if (currentOwner?.token !== owner.token) {
120 return;
121 }
122 rmSync(lockDir, { recursive: true, force: true });
123 },
124 };
125}
126
127function tryAcquireGuard(
128 lockDir: string,

Callers 2

tryAcquireGuardFunction · 0.70
tryAcquireFsLockSyncFunction · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected