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

Function readDaemonLockInfo

src/daemon/client/daemon-client-metadata.ts:93–107  ·  view source on GitHub ↗
(lockPath: string)

Source from the content-addressed store, hash-verified

91}
92
93function readDaemonLockInfo(lockPath: string): DaemonLockInfo | null {
94 const data = readJsonFile(lockPath);
95 if (!data || typeof data !== 'object') return null;
96 const parsed = data as Partial<DaemonLockInfo>;
97 const hasPid = Number.isInteger(parsed.pid) && Number(parsed.pid) > 0;
98 if (!hasPid) {
99 return null;
100 }
101 return {
102 pid: Number(parsed.pid),
103 processStartTime:
104 typeof parsed.processStartTime === 'string' ? parsed.processStartTime : undefined,
105 startedAt: typeof parsed.startedAt === 'number' ? parsed.startedAt : undefined,
106 };
107}
108
109export function removeDaemonInfo(infoPath: string): void {
110 removeFileIfExists(infoPath);

Callers 3

recoverDaemonLockHolderFunction · 0.85

Calls 1

readJsonFileFunction · 0.85

Tested by

no test coverage detected