pub fn run_capture(program: &str, args: &[&str]) -> Result<String, CommandError>Expand description
What: Run a command via SystemCommandRunner and capture stdout as UTF-8.
Inputs:
program: Executable name to run (for example,"pacman").args: Slice of positional arguments passed to the executable.
Output:
Ok(String)containing UTF-8 stdout on success.Err(CommandError)when spawning fails, the command exits non-zero, or stdout is not valid UTF-8.
ยงErrors
- Returns
Err(CommandError::Io)when command spawning or execution fails - Returns
Err(CommandError::Utf8)when stdout cannot be decoded as UTF-8 - Returns
Err(CommandError::Failed)when the command exits with a non-zero status
Details:
- Thin convenience wrapper around
SystemCommandRunner::run; use the trait directly when dependency injection is needed for testing.