feat: add debug logs to mode_diff function
This commit is contained in:
committed by
Andrew Phillips (aider)
parent
1852778f75
commit
ec8bc20373
@@ -522,6 +522,8 @@ fn mode_diff(cmd: &mut Command, args: Args, ids: &mut Vec<i64>, tags: &mut Vec<S
|
|||||||
let (fd_a_read, fd_a_write) = unistd::pipe().unwrap();
|
let (fd_a_read, fd_a_write) = unistd::pipe().unwrap();
|
||||||
let (fd_b_read, fd_b_write) = unistd::pipe().unwrap();
|
let (fd_b_read, fd_b_write) = unistd::pipe().unwrap();
|
||||||
|
|
||||||
|
debug!("MAIN: Creating child process for diff");
|
||||||
|
|
||||||
let child = std::process::Command::new("diff")
|
let child = std::process::Command::new("diff")
|
||||||
.arg("-u")
|
.arg("-u")
|
||||||
.arg(format!("/dev/fd/{}", fd_a_read))
|
.arg(format!("/dev/fd/{}", fd_a_read))
|
||||||
@@ -532,13 +534,18 @@ fn mode_diff(cmd: &mut Command, args: Args, ids: &mut Vec<i64>, tags: &mut Vec<S
|
|||||||
.spawn()
|
.spawn()
|
||||||
.expect("Failed to execute diff command");
|
.expect("Failed to execute diff command");
|
||||||
|
|
||||||
|
debug!("MAIN: Creating buffers");
|
||||||
|
|
||||||
let stdout_a_raw = unsafe { std::fs::File::from_raw_fd(fd_a_write) };
|
let stdout_a_raw = unsafe { std::fs::File::from_raw_fd(fd_a_write) };
|
||||||
let stdout_b_raw = unsafe { std::fs::File::from_raw_fd(fd_b_write) };
|
let stdout_b_raw = unsafe { std::fs::File::from_raw_fd(fd_b_write) };
|
||||||
let mut stdout_a = BufWriter::new(stdout_a_raw);
|
let mut stdout_a = BufWriter::new(stdout_a_raw);
|
||||||
let mut stdout_b = BufWriter::new(stdout_b_raw);
|
let mut stdout_b = BufWriter::new(stdout_b_raw);
|
||||||
|
|
||||||
|
debug!("MAIN: Sending item A to diff");
|
||||||
compression_engine_a.copy(item_path_a.clone(), &mut stdout_a)?;
|
compression_engine_a.copy(item_path_a.clone(), &mut stdout_a)?;
|
||||||
|
debug!("MAIN: Sending item B to diff");
|
||||||
compression_engine_b.copy(item_path_b.clone(), &mut stdout_b)?;
|
compression_engine_b.copy(item_path_b.clone(), &mut stdout_b)?;
|
||||||
|
debug!("MAIN: Done copying data to FDs");
|
||||||
|
|
||||||
let output = child.wait_with_output().expect("Failed to wait on diff command");
|
let output = child.wait_with_output().expect("Failed to wait on diff command");
|
||||||
if output.status.success() {
|
if output.status.success() {
|
||||||
|
|||||||
Reference in New Issue
Block a user