Skip to content

Commit d0712f6

Browse files
committed
Reimplement patch application to be xplat
1 parent f96285b commit d0712f6

File tree

1 file changed

+7
-7
lines changed

1 file changed

+7
-7
lines changed

collector/src/execute.rs

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1546,14 +1546,14 @@ impl Patch {
15461546
}
15471547
}
15481548

1549-
pub fn apply(&self, dir: &Path) -> Result<(), String> {
1549+
pub fn apply(&self, dir: &Path) -> anyhow::Result<()> {
15501550
log::debug!("applying {} to {:?}", self.name, dir);
1551-
let mut cmd = Command::new("patch");
1552-
cmd.current_dir(dir).args(&["-Np1", "-i"]).arg(&*self.path);
1553-
cmd.stdout(Stdio::null());
1554-
if cmd.status().map(|s| !s.success()).unwrap_or(false) {
1555-
return Err(format!("could not execute {:?}.", cmd));
1556-
}
1551+
1552+
let mut cmd = Command::new("git");
1553+
cmd.current_dir(dir).args(&["apply"]).args(&["-Np1"]).arg(&*self.path);
1554+
1555+
command_output(&mut cmd)?;
1556+
15571557
Ok(())
15581558
}
15591559
}

0 commit comments

Comments
 (0)