cuda-doctor logo

PATH and subprocess helper

Implementedv0.0.0

src/core/process.cpp

src/core/process.cpp is the low-level helper behind most probes. It searches PATH, executes shell commands via `popen`, trims trailing whitespace from output, and normalizes exit codes across Unix and Windows branches.

Behavior

  • Splits PATH on `:` and returns the first matching executable path.
  • Uses `popen` to capture stdout from shell commands.
  • Trims newline, carriage return, and leading/trailing spaces from captured output.
  • Normalizes Unix wait status with `WIFEXITED` and `WIFSIGNALED` when not on Windows.

Caveats

This implementation is intentionally lightweight, but it depends on shell command strings and PATH discovery. That is acceptable for early probe work, though richer cross-platform process handling may eventually want a stricter abstraction.