mirror of
https://git.alemi.dev/tci.git
synced 2024-11-23 16:44:48 +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};
|
use git2::{Config, Repository};
|
||||||
|
|
||||||
fn main() {
|
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??"))
|
let callback = std::path::Path::new(&std::env::args().next().expect("no argv0??"))
|
||||||
.file_name()
|
.file_name()
|
||||||
.expect("path terminates with '...'")
|
.expect("path terminates with '...'")
|
||||||
|
@ -45,7 +39,13 @@ fn main() {
|
||||||
std::process::exit(1);
|
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) {
|
match std::str::from_utf8(&output.stdout) {
|
||||||
Ok(s) => println!("{s}"),
|
Ok(s) => println!("{s}"),
|
||||||
|
|
Loading…
Reference in a new issue