ref true/false

This commit is contained in:
2020-05-02 23:58:24 +08:00
parent 13524bad10
commit cfa670c0e8

View File

@@ -133,9 +133,10 @@ fn process_config_item(options: &Options, config_item: &OSSBackupdConfigItem,
let zip_file = || {
if let Err(e) = zip_util::compress_file(target, temp_zip_file) {
print_error(&format!("Error in zip file: {}, at item index: {}", e, item_index));
return false;
};
false
} else {
true
}
};
#[cfg(feature = "use_zip")]
let zip_file = || {
@@ -143,9 +144,10 @@ fn process_config_item(options: &Options, config_item: &OSSBackupdConfigItem,
cmd.args(&["-r", temp_zip_file, target]);
if let Err(e) = rust_util::util_cmd::run_command_and_wait(&mut cmd) {
print_message(MessageType::ERROR, &format!("Error in zip file: {}, at item index: {}", e, item_index));
return false;
}
false
} else {
true
}
};
if !zip_file() {
@@ -166,9 +168,10 @@ fn process_config_item(options: &Options, config_item: &OSSBackupdConfigItem,
if let Err(e) = open_pgp_tool.encrypt_file(temp_zip_file, temp_pgp_file, false) {
print_message(MessageType::ERROR, &format!("Error in encrypt file: {}, at item index: {}", e, item_index));
remove_temp_files();
return false;
};
false
} else {
true
}
};
#[cfg(not(feature = "use_sequoia_openpgp"))]
let enc_file_by_pgp = || {
@@ -176,9 +179,10 @@ fn process_config_item(options: &Options, config_item: &OSSBackupdConfigItem,
cmd.args(&["-e", "-r", encrypt_pubkey_file, "-o", temp_pgp_file, temp_zip_file]);
if let Err(e) = rust_util::util_cmd::run_command_and_wait(&mut cmd) {
print_error(&format!("Error in encrypt file: {}, at item index: {}", e, item_index));
return false;
}
false
} else {
true
}
};
if !enc_file_by_pgp() {