Skip to content

Commit a06ede7

Browse files
committed
let xcompress export the exist status
1 parent 92ae4bd commit a06ede7

File tree

2 files changed

+12
-8
lines changed

2 files changed

+12
-8
lines changed

Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[package]
22
name = "xcompress"
3-
version = "0.10.3"
3+
version = "0.10.4"
44
authors = ["Magic Len <len@magiclen.org>"]
55
repository = "https://github.com/magiclen/xcompress"
66
homepage = "https://magiclen.org/xcompress"

src/lib.rs

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -894,11 +894,12 @@ pub fn run(config: Config) -> Result<i32, String> {
894894
};
895895
let quiet = config.quiet;
896896

897-
match config.mode {
897+
let es = match config.mode {
898898
Mode::Archive(best_compression, split, input_paths, output_path) => {
899899
match output_path {
900900
Some(p) => {
901-
archive(&paths, quiet, cpus, &password, false, best_compression, split, &input_paths, &p)?;
901+
let es = archive(&paths, quiet, cpus, &password, false, best_compression, split, &input_paths, &p)?;
902+
es
902903
}
903904
None => {
904905
let current_dir = env::current_dir().unwrap();
@@ -907,25 +908,28 @@ pub fn run(config: Config) -> Result<i32, String> {
907908

908909
let output_path = Path::join(&current_dir, Path::new(&format!("{}.rar", input_path.file_name().unwrap().to_str().unwrap())));
909910

910-
archive(&paths, quiet, cpus, &password, false, best_compression, split, &input_paths, output_path.to_str().unwrap())?;
911+
let es = archive(&paths, quiet, cpus, &password, false, best_compression, split, &input_paths, output_path.to_str().unwrap())?;
912+
es
911913
}
912914
}
913915
}
914916
Mode::Extract(input_path, output_path) => {
915917
match output_path {
916918
Some(p) => {
917-
extract(&paths, quiet, cpus, &password, false, &input_path, &p)?;
919+
let es = extract(&paths, quiet, cpus, &password, false, &input_path, &p)?;
920+
es
918921
}
919922
None => {
920923
let current_dir = env::current_dir().unwrap();
921924

922-
extract(&paths, quiet, cpus, &password, false, &input_path, current_dir.to_str().unwrap())?;
925+
let es = extract(&paths, quiet, cpus, &password, false, &input_path, current_dir.to_str().unwrap())?;
926+
es
923927
}
924928
}
925929
}
926-
}
930+
};
927931

928-
Ok(0)
932+
Ok(es)
929933
}
930934

931935
// TODO -----Archive START-----

0 commit comments

Comments
 (0)