Skip to content

Commit ceb8826

Browse files
committed
feat!: add Context::stderr to configure whether or not to supress stderr.
1 parent 6cf73a4 commit ceb8826

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

gix-command/src/lib.rs

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,10 @@ pub struct Context {
6868
/// If `true`, set `GIT_ICASE_PATHSPECS` to `1`, to let patterns match case-insensitively, or `0` otherwise.
6969
/// If `None`, the variable won't be set.
7070
pub icase_pathspecs: Option<bool>,
71+
/// If `true`, inherit `stderr` just like it's the default when spawning processes.
72+
/// If `false`, suppress all stderr output.
73+
/// If not `None`, this will override any value set with [`Prepare::stderr()`].
74+
pub stderr: Option<bool>,
7175
}
7276

7377
mod prepare {
@@ -237,6 +241,9 @@ mod prepare {
237241
if let Some(value) = ctx.icase_pathspecs {
238242
cmd.env("GIT_ICASE_PATHSPECS", usize::from(value).to_string());
239243
}
244+
if let Some(stderr) = ctx.stderr {
245+
cmd.stderr(if stderr { Stdio::inherit() } else { Stdio::null() });
246+
}
240247
}
241248
cmd
242249
}

0 commit comments

Comments
 (0)