Spawn thread for building, allows for multiple build at the same time
This commit is contained in:
parent
f65602fb71
commit
749692bb07
|
@ -18,7 +18,6 @@ use mars::{GeneralBuilder, builder_arguments_from_string};
|
||||||
|
|
||||||
fn main() {
|
fn main() {
|
||||||
|
|
||||||
let builder = GeneralBuilder::new();
|
|
||||||
|
|
||||||
let (tx, rx) = mpsc::channel();
|
let (tx, rx) = mpsc::channel();
|
||||||
|
|
||||||
|
@ -53,19 +52,27 @@ fn main() {
|
||||||
|
|
||||||
while let Some(uri) = tasks.pop() {
|
while let Some(uri) = tasks.pop() {
|
||||||
|
|
||||||
let uri = percent_decode(uri.path().as_bytes()).decode_utf8().unwrap();
|
thread::spawn(move || {
|
||||||
let (path, args) = builder_arguments_from_string(&*uri);
|
|
||||||
|
|
||||||
println!("{}", format!("---- STARTING BUILD ---- from {}", uri).bold().green());
|
let builder = GeneralBuilder::new();
|
||||||
match builder.build(&path, &args) {
|
let uri = percent_decode(uri.path().as_bytes()).decode_utf8().unwrap();
|
||||||
Err(_) => {
|
let (path, args) = builder_arguments_from_string(&*uri);
|
||||||
println!("{}", "--------- FAIL ---------".bold().red());
|
|
||||||
},
|
let path_string = path.to_str().unwrap();
|
||||||
Ok(_) => {
|
let start_string = format!("---- STARTING BUILD ---- from {} {}", path_string, args.join(" "));
|
||||||
println!("{}", "----- SUCCESSFUL -----".bold().green());
|
println!("{}", start_string.bold().green());
|
||||||
},
|
|
||||||
};
|
match builder.build(&path, &args) {
|
||||||
println!();
|
Err(_) => {
|
||||||
|
println!("{}", "--------- FAIL ---------".bold().red());
|
||||||
|
},
|
||||||
|
Ok(_) => {
|
||||||
|
println!("{}", "----- SUCCESSFUL -----".bold().green());
|
||||||
|
},
|
||||||
|
};
|
||||||
|
println!();
|
||||||
|
|
||||||
|
});
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue