Skip to content

Commit

Permalink
feat!: add Context::stderr to configure whether or not to supress `…
Browse files Browse the repository at this point in the history
…stderr`.
  • Loading branch information
Byron committed Dec 6, 2023
1 parent 6cf73a4 commit ceb8826
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions gix-command/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,10 @@ pub struct Context {
/// If `true`, set `GIT_ICASE_PATHSPECS` to `1`, to let patterns match case-insensitively, or `0` otherwise.
/// If `None`, the variable won't be set.
pub icase_pathspecs: Option<bool>,
/// If `true`, inherit `stderr` just like it's the default when spawning processes.
/// If `false`, suppress all stderr output.
/// If not `None`, this will override any value set with [`Prepare::stderr()`].
pub stderr: Option<bool>,
}

mod prepare {
Expand Down Expand Up @@ -237,6 +241,9 @@ mod prepare {
if let Some(value) = ctx.icase_pathspecs {
cmd.env("GIT_ICASE_PATHSPECS", usize::from(value).to_string());
}
if let Some(stderr) = ctx.stderr {
cmd.stderr(if stderr { Stdio::inherit() } else { Stdio::null() });
}
}
cmd
}
Expand Down

0 comments on commit ceb8826

Please sign in to comment.