MCPcopy Create free account
hub / github.com/colbymchenry/codegraph / writeLock

Function writeLock

__tests__/daemon-lock-holder.test.ts:89–98  ·  view source on GitHub ↗

A current-format lock whose socket no daemon listens on.

(pid: number)

Source from the content-addressed store, hash-verified

87
88/** A current-format lock whose socket no daemon listens on. */
89function writeLock(pid: number): string {
90 const lockPath = getDaemonPidPath(root);
91 fs.writeFileSync(lockPath, encodeLockInfo({
92 pid,
93 version: '1.6.2',
94 socketPath: windows ? '\\\\.\\pipe\\codegraph-2770-nobody-listens' : path.join(root, '.codegraph', 'nobody-listens.sock'),
95 startedAt: Date.now() - 60_000,
96 }));
97 return lockPath;
98}
99
100function stopCommand(pid: number): string {
101 return windows ? `taskkill /PID ${pid} /F` : `kill ${pid}`;

Callers 1

Calls 3

getDaemonPidPathFunction · 0.90
encodeLockInfoFunction · 0.90
joinMethod · 0.45

Tested by

no test coverage detected