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

Function readProcessCommand

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

Source from the content-addressed store, hash-verified

44}
45
46export function readProcessCommand(pid: number): string | null {
47 if (!Number.isInteger(pid) || pid <= 0) return null;
48 try {
49 const result = runCmdSync('ps', ['-p', String(pid), '-o', 'command='], {
50 allowFailure: true,
51 timeoutMs: PS_TIMEOUT_MS,
52 });
53 if (result.exitCode !== 0) return null;
54 const value = result.stdout.trim();
55 return value.length > 0 ? value : null;
56 } catch {
57 return null;
58 }
59}
60
61export function isAgentDeviceDaemonCommand(command: string): boolean {
62 const normalized = command.toLowerCase().replaceAll('\\', '/');

Callers 8

shouldReuseCompanionFunction · 0.90
stopCompanionProcessFunction · 0.90
spawnCompanionProcessFunction · 0.90
writePidFileFunction · 0.90

Calls 1

runCmdSyncFunction · 0.90

Tested by

no test coverage detected