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

Function readProcessStartTime

src/utils/process-identity.ts:31–44  ·  view source on GitHub ↗
(pid: number)

Source from the content-addressed store, hash-verified

29}
30
31export function readProcessStartTime(pid: number): string | null {
32 if (!Number.isInteger(pid) || pid <= 0) return null;
33 try {
34 const result = runCmdSync('ps', ['-p', String(pid), '-o', 'lstart='], {
35 allowFailure: true,
36 timeoutMs: PS_TIMEOUT_MS,
37 });
38 if (result.exitCode !== 0) return null;
39 const value = result.stdout.trim();
40 return value.length > 0 ? value : null;
41 } catch {
42 return null;
43 }
44}
45
46export function readProcessCommand(pid: number): string | null {
47 if (!Number.isInteger(pid) || pid <= 0) return null;

Callers 15

shouldReuseCompanionFunction · 0.90
spawnCompanionProcessFunction · 0.90
isLiveProcessLockOwnerFunction · 0.90
acquireSwiftCacheLockFunction · 0.90
currentProcessOwnerFunction · 0.90
writeDaemonInfoFunction · 0.90
installSpawnedHttpDaemonFunction · 0.90
writeCurrentDaemonInfoFunction · 0.90
writePidFileFunction · 0.90

Calls 1

runCmdSyncFunction · 0.90

Tested by 4

currentProcessOwnerFunction · 0.72
writeDaemonInfoFunction · 0.72
installSpawnedHttpDaemonFunction · 0.72
writeCurrentDaemonInfoFunction · 0.72