Add command module #10

Merged
Mr_Steppy merged 8 commits from command-execution into master 2025-01-08 16:32:46 +01:00
Showing only changes of commit b6002b635d - Show all commits

View File

@ -84,4 +84,29 @@ impl Display for ExecutionError {
}
}
impl Error for ExecutionError {}
impl Error for ExecutionError {}
#[cfg(test)]
mod test {
use crate::command::{ExecutionError, LogRunnable, SpecificExecutionError};
use crate::logger::Logger;
use std::process::Command;
#[test]
fn test_unknown_command() {
let mut command = Command::new("a_command_which_def_doesnt_exist");
let Err(
e @ SpecificExecutionError {
error: ExecutionError::StartError(_),
..
},
) = command.args(["foo", "bar"]).run(&Logger::default())
else {
panic!("command shouldn't exist");
};
println!("{e}");
}
#[test]
fn test_error() {}
}