MCPcopy
hub / github.com/claude-code-best/claude-code / updatePidFile

Function updatePidFile

src/utils/concurrentSessions.ts:116–129  ·  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

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

Callers 4

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

Calls 6

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

Tested by

no test coverage detected