MCPcopy Create free account
hub / github.com/AnukarOP/claude-code-leaked / updatePidFile

Function updatePidFile

source code/utils/concurrentSessions.ts:118–131  ·  view source on GitHub ↗

* Update this session's name in its PID registry file so ListPeers * can surface it. Best-effort: silently no-op if name is falsy, the * file doesn't exist (session not registered), or read/write fails.

(patch: Record<string, unknown>)

Source from the content-addressed store, hash-verified

116 * file doesn't exist (session not registered), or read/write fails.
117 */
118async function updatePidFile(patch: Record<string, unknown>): Promise<void> {
119 const pidFile = join(getSessionsDir(), `${process.pid}.json`)
120 try {
121 const data = jsonParse(await readFile(pidFile, 'utf8')) as Record<
122 string,
123 unknown
124 >
125 await writeFile(pidFile, jsonStringify({ ...data, ...patch }))
126 } catch (e) {
127 logForDebugging(
128 `[concurrentSessions] updatePidFile failed: ${errorMessage(e)}`,
129 )
130 }
131}
132
133export async function updateSessionName(
134 name: string | undefined,

Callers 4

registerSessionFunction · 0.85
updateSessionNameFunction · 0.85
updateSessionBridgeIdFunction · 0.85
updateSessionActivityFunction · 0.85

Calls 6

getSessionsDirFunction · 0.85
jsonParseFunction · 0.85
readFileFunction · 0.85
jsonStringifyFunction · 0.85
logForDebuggingFunction · 0.85
errorMessageFunction · 0.70

Tested by

no test coverage detected