src : affichage du message d'erreur en cas de commande introuvable

This commit is contained in:
Ahurac 2024-04-10 10:03:29 +02:00
parent ad73edfb2f
commit f48a79df4e
2 changed files with 5 additions and 1 deletions

View file

@ -1,3 +1,5 @@
use crate::error;
pub struct ExitCode {
exit_code: u8,
}
@ -36,7 +38,7 @@ impl Command for UnixProgram {
let mut argv = self.argv.clone();
let program = argv.remove(0);
let mut command = std::process::Command::new(program);
let mut command = std::process::Command::new(&program);
command.args(argv);
let handle = command.spawn();
@ -56,6 +58,7 @@ impl Command for UnixProgram {
exit_code
} else {
error::print_error(format!("{}: command not found", program));
ExitCode::new(127)
}
}

View file

@ -1,5 +1,6 @@
mod command;
mod control;
mod error;
mod interface;
fn main() {