Get detailed information about processes. Args: pids: Set of process IDs Returns: List of dictionaries with process information
(pids: set[int])
| 290 | |
| 291 | |
| 292 | def get_process_info(pids: set[int]) -> list[dict[str, Any]]: |
| 293 | """Get detailed information about processes. |
| 294 | |
| 295 | Args: |
| 296 | pids: Set of process IDs |
| 297 | |
| 298 | Returns: |
| 299 | List of dictionaries with process information |
| 300 | """ |
| 301 | if not is_psutil_available(): |
| 302 | return [] |
| 303 | |
| 304 | process_info: list[dict[str, Any]] = [] |
| 305 | |
| 306 | for pid in pids: |
| 307 | try: |
| 308 | proc = psutil.Process(pid) |
| 309 | info = { |
| 310 | "pid": pid, |
| 311 | "name": proc.name(), |
| 312 | "exe": proc.exe(), |
| 313 | "cmdline": " ".join(proc.cmdline()), |
| 314 | "status": proc.status(), |
| 315 | } |
| 316 | process_info.append(info) |
| 317 | except (psutil.NoSuchProcess, psutil.AccessDenied): |
| 318 | process_info.append( |
| 319 | { |
| 320 | "pid": pid, |
| 321 | "name": "Unknown", |
| 322 | "exe": "Unknown", |
| 323 | "cmdline": "Unknown", |
| 324 | "status": "Unknown", |
| 325 | } |
| 326 | ) |
| 327 | |
| 328 | return process_info |
nothing calls this directly
no test coverage detected