whyno-cli 0.2.0

Linux permission debugger
//! Shared helpers for integration tests.

use std::process::Command;

/// Path to compiled `whyno` binary.
pub fn whyno_bin() -> String {
    env!("CARGO_BIN_EXE_whyno").to_string()
}

/// Current user's username from environment.
pub fn current_username() -> String {
    std::env::var("USER")
        .or_else(|_| std::env::var("LOGNAME"))
        .expect("cannot determine current username from USER or LOGNAME env vars")
}

/// Runs whyno with args, suppressing color output.
pub fn run_whyno(args: &[&str]) -> std::process::Output {
    Command::new(whyno_bin())
        .args(args)
        .env("NO_COLOR", "1")
        .output()
        .expect("failed to execute whyno binary")
}