mirror of
https://git.alemi.dev/tci.git
synced 2024-11-23 08:34:51 +01:00
fix: don't crash if tci script fails
This commit is contained in:
parent
7f9ec06586
commit
60e7edc765
1 changed files with 7 additions and 7 deletions
14
src/main.rs
14
src/main.rs
|
@ -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}"),
|
||||
|
|
Loading…
Reference in a new issue