refactor: add copy method to CompressionEngine and update mode_diff to use it

This commit is contained in:
Andrew Phillips (aider)
2025-05-06 11:39:44 -03:00
parent 4a09c8fd72
commit 054291383c
5 changed files with 34 additions and 6 deletions

View File

@@ -535,8 +535,11 @@ fn mode_diff(cmd: &mut Command, args: Args, ids: &mut Vec<i64>, tags: &mut Vec<S
let stdout_a = unsafe { std::fs::File::from_raw_fd(fd_a_write) };
let stdout_b = unsafe { std::fs::File::from_raw_fd(fd_b_write) };
compression_engine_a.cat(item_path_a.clone())?;
compression_engine_b.cat(item_path_b.clone())?;
let mut stdout_a = unsafe { std::fs::File::from_raw_fd(fd_a_write) };
let mut stdout_b = unsafe { std::fs::File::from_raw_fd(fd_b_write) };
compression_engine_a.copy(item_path_a.clone(), &mut stdout_a)?;
compression_engine_b.copy(item_path_b.clone(), &mut stdout_b)?;
let output = child.wait_with_output().expect("Failed to wait on diff command");