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

Function writePidFile

src/daemon/app-log-process.ts:77–87  ·  view source on GitHub ↗
(pidPath: string | undefined, pid: number)

Source from the content-addressed store, hash-verified

75}
76
77export function writePidFile(pidPath: string | undefined, pid: number): void {
78 if (!pidPath) return;
79 const dir = path.dirname(pidPath);
80 if (!fs.existsSync(dir)) fs.mkdirSync(dir, { recursive: true });
81 const metadata: StoredAppLogProcessMeta = {
82 pid,
83 startTime: readProcessStartTime(pid) ?? undefined,
84 command: readProcessCommand(pid) ?? undefined,
85 };
86 fs.writeFileSync(pidPath, `${JSON.stringify(metadata)}\n`);
87}
88
89export function clearPidFile(pidPath: string | undefined): void {
90 if (!pidPath || !fs.existsSync(pidPath)) return;

Callers 2

startAndroidAppLogFunction · 0.90
startAppleAppLogStreamFunction · 0.90

Calls 2

readProcessStartTimeFunction · 0.90
readProcessCommandFunction · 0.90

Tested by

no test coverage detected