Skip to content

Commit

Permalink
use exec_with_output instead of exec_with_streaming
Browse files Browse the repository at this point in the history
  • Loading branch information
ibraheemdev committed May 30, 2024
1 parent d0c9143 commit 915d8d8
Showing 1 changed file with 8 additions and 14 deletions.
22 changes: 8 additions & 14 deletions crates/uv-git/src/git.rs
Original file line number Diff line number Diff line change
Expand Up @@ -149,7 +149,7 @@ impl GitRepository {
ProcessBuilder::new("git")
.arg("rev-parse")
.cwd(path)
.exec_with_streaming(&mut silent, &mut silent, true)?;
.exec_with_output()?;

Ok(GitRepository {
path: path.to_path_buf(),
Expand All @@ -168,7 +168,7 @@ impl GitRepository {
ProcessBuilder::new("git")
.arg("init")
.cwd(path)
.exec_with_streaming(&mut silent, &mut silent, true)?;
.exec_with_output()?;

Ok(GitRepository {
path: path.to_path_buf(),
Expand All @@ -181,7 +181,7 @@ impl GitRepository {
.arg("rev-parse")
.arg(refname)
.cwd(&self.path)
.exec_with_streaming(&mut silent, &mut silent, true)?;
.exec_with_output()?;

let mut result = String::from_utf8(result.stdout)?;
result.truncate(result.trim_end().len());
Expand Down Expand Up @@ -289,7 +289,7 @@ impl GitDatabase {
.arg("--short")
.arg(revision.as_str())
.cwd(&self.repo.path)
.exec_with_streaming(&mut silent, &mut silent, true)?;
.exec_with_output()?;

let mut result = String::from_utf8(output.stdout)?;
result.truncate(result.trim_end().len());
Expand Down Expand Up @@ -369,7 +369,7 @@ impl GitCheckout {
// have a HEAD checked out.
.arg(database.repo.path.simplified_display().to_string())
.arg(into.simplified_display().to_string())
.exec_with_streaming(&mut silent, &mut silent, true)?;
.exec_with_output()?;

let repo = GitRepository::open(into)?;
let checkout = GitCheckout::new(revision, repo);
Expand Down Expand Up @@ -412,7 +412,7 @@ impl GitCheckout {
.arg("--hard")
.arg(self.revision.as_str())
.cwd(&self.repo.path)
.exec_with_streaming(&mut silent, &mut silent, true)?;
.exec_with_output()?;

paths::create(ok_file)?;
Ok(())
Expand All @@ -426,7 +426,7 @@ impl GitCheckout {
.arg("--recursive")
.arg("--init")
.cwd(&self.repo.path)
.exec_with_streaming(&mut silent, &mut silent, true)
.exec_with_output()
.map(drop)
}
}
Expand Down Expand Up @@ -608,13 +608,7 @@ fn fetch_with_cli(
// We capture the output to avoid streaming it to the user's console during clones.
// The required `on...line` callbacks currently do nothing.
// The output appears to be included in error messages by default.
cmd.exec_with_streaming(&mut silent, &mut silent, true)?;
Ok(())
}

/// Callback used with `exec_with_streaming` that silences the output.
#[allow(clippy::unnecessary_wraps)]
fn silent(_: &str) -> Result<()> {
cmd.exec_with_output()?;
Ok(())
}

Expand Down

0 comments on commit 915d8d8

Please sign in to comment.