#5973 [Other] add opt-in Rust strata-procs crate for process identity and command-line inspection

open · @stuchapin909 · 0 评论 · 去 GitHub 看

WindowsLinux

说明

## Problem
`strata_control/procs.py` relies on `psutil` and per-call Python Win32 bindings to read process creation times, command lines, parent PIDs, and executable paths when verifying leftover engine processes. Providing an opt-in Rust crate (`crates/strata-procs`) removes the `psutil` dependency on the hot path while preserving pure-Python/psutil fallbacks when unbuilt.

## Changes
- Added `crates/strata-procs` (`std`-only, using Win32 `GetProcessTimes`, `NtQueryInformationProcess`, `QueryFullProcessImageNameW`, and `CommandLineToArgvW` on Windows; `/proc` on Linux).
- Wired `strata_control/procs.py` (`start_token`, `command_line`) to call `crates/strata-procs/target/release/strata-procs(.exe)` (or `STRATA_PROCS_BIN`) when present, falling back to Python/`psutil` otherwise.

## Validation
- **Passed:**
  - `cargo test` in `crates/strata-procs`: 2 passed, 0 failed.
  - `cargo clippy --all-targets -- -D warnings`: 0 warnings.
  - `python -m unittest tests/terminal/test_procs.py tests/terminal/test_launch_identity.py tests/terminal/test_launch_leftover_4824.py`: 25 passed, 0 failed.
  - Differential check on live PID (`strata-procs.exe` vs `winproc.process_started` + `psutil.Process.cmdline()`): exact match on `start_token` and `command_line`.
- **Failed:** None.
- **Not run:** Linux/macOS builds and full `tests/terminal` suite outside the 3 process/identity test files above.

本站相关内容

相关页面的快捷入口。