PATH and subprocess helper
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.
Related files
Core contract
include/core/process.hpp
Declares the small command execution API used by the driver, GPU, and CUDA probes.
Core implementation
src/core/driver.cpp
Checks for `nvidia-smi` and, when available, queries the GPU driver version.
Core implementation
src/core/gpu.cpp
Uses `nvidia-smi` to ask for the GPU name and treats the driver tool as a prerequisite, not as proof that no GPU exists.
Core implementation
src/core/cuda_env.cpp
Finds `nvcc`, searches common CUDA install roots, parses `nvcc --version`, and derives the toolkit root directory.