MCPcopy Index your code
hub / github.com/callstack/agent-device / tryWriteLock

Function tryWriteLock

src/daemon/server/server-lifecycle.ts:79–87  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

77 const payload = JSON.stringify(lockData, null, 2);
78
79 const tryWriteLock = (): boolean => {
80 try {
81 fs.writeFileSync(lockPath, payload, { flag: 'wx', mode: 0o600 });
82 return true;
83 } catch (err) {
84 if ((err as NodeJS.ErrnoException).code === 'EEXIST') return false;
85 throw err;
86 }
87 };
88
89 if (tryWriteLock()) return true;
90 const existing = readLockInfo(lockPath);

Callers 1

acquireDaemonLockFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected