MCPcopy Index your code
hub / github.com/codeaashu/claude-code / readLockContent

Function readLockContent

src/utils/nativeInstaller/pidLock.ts:137–159  ·  view source on GitHub ↗
(
  lockFilePath: string,
)

Source from the content-addressed store, hash-verified

135 * Read and parse a lock file's content
136 */
137export function readLockContent(
138 lockFilePath: string,
139): VersionLockContent | null {
140 const fs = getFsImplementation()
141
142 try {
143 const content = fs.readFileSync(lockFilePath, { encoding: 'utf8' })
144 if (!content || content.trim() === '') {
145 return null
146 }
147
148 const parsed = jsonParse(content) as VersionLockContent
149
150 // Validate required fields
151 if (typeof parsed.pid !== 'number' || !parsed.version || !parsed.execPath) {
152 return null
153 }
154
155 return parsed
156 } catch {
157 return null
158 }
159}
160
161/**
162 * Check if a lock file represents an active lock (process still running)

Callers 4

updateLatestFunction · 0.85
isLockActiveFunction · 0.85
tryAcquireLockFunction · 0.85
getAllLockInfoFunction · 0.85

Calls 2

getFsImplementationFunction · 0.85
jsonParseFunction · 0.85

Tested by

no test coverage detected