Skip to content

Commit fbf75fd

Browse files
bonigarciadiemol
andauthored
[rust] Fix Edge management in RPM-based Linux (#13705)
* [rust] Use shell command to move extracted Edge to cache * [rust] Enhance logic to move Edge from temporal folder to cache --------- Co-authored-by: Diego Molina <[email protected]>
1 parent 0c81991 commit fbf75fd

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

rust/src/files.rs

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -131,7 +131,7 @@ pub fn uncompress(
131131
} else if extension.eq_ignore_ascii_case(EXE) {
132132
uncompress_sfx(compressed_file, target, log)?
133133
} else if extension.eq_ignore_ascii_case(DEB) {
134-
uncompress_deb(compressed_file, target, log, volume.unwrap_or_default())?
134+
uncompress_deb(compressed_file, target, log, os, volume.unwrap_or_default())?
135135
} else if extension.eq_ignore_ascii_case(MSI) {
136136
install_msi(compressed_file, log, os)?
137137
} else if extension.eq_ignore_ascii_case(XML) || extension.eq_ignore_ascii_case(HTML) {
@@ -249,6 +249,7 @@ pub fn uncompress_deb(
249249
compressed_file: &str,
250250
target: &Path,
251251
log: &Logger,
252+
os: &str,
252253
label: &str,
253254
) -> Result<(), Error> {
254255
let zip_parent = Path::new(compressed_file).parent().unwrap();
@@ -265,12 +266,17 @@ pub fn uncompress_deb(
265266
let zip_parent_str = path_to_string(zip_parent);
266267
let target_str = path_to_string(target);
267268
let opt_edge_str = format!("{}/opt/microsoft/{}", zip_parent_str, label);
269+
let opt_edge_mv = format!("mv {} {}", opt_edge_str, target_str);
270+
let command = Command::new_single(opt_edge_mv.clone());
268271
log.trace(format!(
269272
"Moving extracted files and folders from {} to {}",
270273
opt_edge_str, target_str
271274
));
272275
create_parent_path_if_not_exists(target)?;
273-
fs::rename(&opt_edge_str, &target_str)?;
276+
let output = run_shell_command_by_os(os, command)?;
277+
if output.is_empty() {
278+
fs::rename(&opt_edge_str, &target_str)?;
279+
}
274280

275281
Ok(())
276282
}

0 commit comments

Comments
 (0)