fix: don't crash if tci script fails

This commit is contained in:
əlemi 2024-02-13 17:17:07 +01:00
parent 7f9ec06586
commit 60e7edc765
Signed by: alemi
GPG key ID: A4895B84D311642C

View file

@ -1,12 +1,6 @@
use git2::{Config, Repository};
fn main() {
// println!("{:?}", std::env::args());
// println!("{}", std::env::current_dir().unwrap().display());
// for (key, value) in std::env::vars() {
// println!("{key}: \t{value}");
// }
let callback = std::path::Path::new(&std::env::args().next().expect("no argv0??"))
.file_name()
.expect("path terminates with '...'")
@ -45,7 +39,13 @@ fn main() {
std::process::exit(1);
}
let output = std::process::Command::new(tmp.path().join(&tci_script)).output().expect("could not run tci script");
let output = match std::process::Command::new(tmp.path().join(&tci_script)).output() {
Ok(out) => out,
Err(e) => {
println!("[!] error running tci script: {e}");
std::process::exit(1);
}
};
match std::str::from_utf8(&output.stdout) {
Ok(s) => println!("{s}"),