refactor: simplify updater tests

This commit is contained in:
amrbashir
2024-11-16 03:14:34 +02:00
parent 7f025e5240
commit 49a4f78806
7 changed files with 220 additions and 296 deletions
+11 -7
View File
@@ -616,12 +616,16 @@ impl Update {
.chain(self.installer_args())
.collect(),
WindowsUpdaterType::Msi { path, .. } => {
let escaped_args = current_args
.iter()
.map(escape_msi_property_arg)
.collect::<Vec<_>>()
.join(" ");
msi_args = OsString::from(format!("LAUNCHAPPARGS=\"{escaped_args}\""));
msi_args = if !current_args.is_empty() {
let escaped_args = current_args
.iter()
.map(escape_msi_property_arg)
.collect::<Vec<_>>()
.join(" ");
OsString::from(format!("LAUNCHAPPARGS=\"{escaped_args}\""))
} else {
OsString::new()
};
[OsStr::new("/i"), path.as_os_str()]
.into_iter()
@@ -629,7 +633,7 @@ impl Update {
.chain(once(OsStr::new("/promptrestart")))
.chain(self.installer_args())
.chain(once(OsStr::new("AUTOLAUNCHAPP=True")))
.chain(once(msi_args.as_os_str()))
.chain(once(msi_args.as_os_str()).filter(|a| !a.is_empty()))
.collect()
}
};