(pid: number)
| 44 | } |
| 45 | |
| 46 | export 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 | |
| 61 | export function isAgentDeviceDaemonCommand(command: string): boolean { |
| 62 | const normalized = command.toLowerCase().replaceAll('\\', '/'); |
no test coverage detected