(pid: number)
| 102 | } |
| 103 | |
| 104 | async function describePsProcess(pid: number): Promise<ProcessDescription> { |
| 105 | const [args, comm] = await Promise.all([ |
| 106 | query('ps', ['-ww', '-o', 'args=', '-p', String(pid)]), |
| 107 | query('ps', ['-o', 'comm=', '-p', String(pid)]), |
| 108 | ]); |
| 109 | return { name: comm?.trim() || null, commandLine: args?.trim() || null }; |
| 110 | } |
| 111 | |
| 112 | /** What the OS says process `pid` is running. Never throws. */ |
| 113 | export async function describeProcess(pid: number): Promise<ProcessDescription> { |
no test coverage detected