doc/readme #1

Merged
ahurac merged 5 commits from doc/readme into main 2023-12-11 12:41:55 +01:00
2 changed files with 25 additions and 1 deletions
Showing only changes of commit 2e45fabc68 - Show all commits

23
src/job.rs Normal file
View file

@ -0,0 +1,23 @@
use std::process::{
Command,
ExitStatus,
};
use std::io::{
Result,
Error,
ErrorKind,
};
pub fn execute(mut argv: Vec<String>) -> Result<ExitStatus> {
let mut command = Command::new(&argv[0]);
argv.remove(0);
command.args(argv);
let child = command.spawn();
if child.is_ok() {
child.unwrap().wait()
} else {
Err(Error::new(ErrorKind::Other, "failed to spawn child process"))
}
}

View file

@ -3,6 +3,7 @@ use std::process::exit;
mod input; mod input;
mod output; mod output;
mod parser; mod parser;
mod job;
fn main() { fn main() {
let mut buffer = input::Buffer::new(); let mut buffer = input::Buffer::new();
@ -15,7 +16,7 @@ fn main() {
argv = buffer.parse(); argv = buffer.parse();
if argv.is_some() { if argv.is_some() {
println!("{:?}", argv.unwrap()); let _ = job::execute(argv.unwrap());
} }
} }