|
|
@ -1,6 +1,7 @@ |
|
|
|
use std::io::ErrorKind::NotFound;
|
|
|
|
use std::process::Command;
|
|
|
|
|
|
|
|
use crate::builtins::{execute_builtin, is_builtin};
|
|
|
|
use crate::error::ShellError;
|
|
|
|
use crate::parse::parse_line;
|
|
|
|
|
|
|
@ -10,10 +11,14 @@ pub fn interpret(line: &str) -> Result<(), ShellError> { |
|
|
|
}
|
|
|
|
let (keyword, args) = parse_line(line);
|
|
|
|
|
|
|
|
let mut command = Command::new(keyword);
|
|
|
|
command.args(args);
|
|
|
|
if is_builtin(keyword) {
|
|
|
|
execute_builtin(keyword, &args)?;
|
|
|
|
} else {
|
|
|
|
let mut command = Command::new(keyword);
|
|
|
|
command.args(args);
|
|
|
|
|
|
|
|
execute(command)?;
|
|
|
|
execute(command)?;
|
|
|
|
}
|
|
|
|
|
|
|
|
Ok(())
|
|
|
|
}
|
|
|
|