use nix::sys::signal::{self, Signal};
use nix::unistd::Pid;

pub fn kill_process(pid: i32, force: bool) -> Result<(), String> {
    let signal = if force {
        Signal::SIGKILL
    } else {
        Signal::SIGTERM
    };

    signal::kill(Pid::from_raw(pid), signal)
        .map_err(|e| format!("Signal failed for PID {}: {}", pid, e))
}
