Skip to content

Commit e2c747d

Browse files
committed
Merge branch 'push-ysnqkzlzwuwq'
2 parents ccc7a1f + cacc8af commit e2c747d

File tree

6 files changed

+39
-16
lines changed

6 files changed

+39
-16
lines changed

gitoxide-core/src/repository/attributes/validate_baseline.rs

Lines changed: 16 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -74,13 +74,14 @@ pub(crate) mod function {
7474
let tx_base = tx_base.clone();
7575
let mut progress = progress.add_child("attributes");
7676
move || -> anyhow::Result<()> {
77-
let mut child = std::process::Command::new(gix::path::env::exe_invocation())
78-
.args(["check-attr", "--stdin", "-a"])
79-
.stdin(std::process::Stdio::piped())
80-
.stdout(std::process::Stdio::piped())
81-
.stderr(std::process::Stdio::null())
82-
.current_dir(path)
83-
.spawn()?;
77+
let mut child =
78+
std::process::Command::from(gix::command::prepare(gix::path::env::exe_invocation()))
79+
.args(["check-attr", "--stdin", "-a"])
80+
.stdin(std::process::Stdio::piped())
81+
.stdout(std::process::Stdio::piped())
82+
.stderr(std::process::Stdio::null())
83+
.current_dir(path)
84+
.spawn()?;
8485

8586
std::thread::spawn({
8687
let mut stdin = child.stdin.take().expect("we configured it");
@@ -125,13 +126,14 @@ pub(crate) mod function {
125126
let tx_base = tx_base.clone();
126127
let mut progress = progress.add_child("excludes");
127128
move || -> anyhow::Result<()> {
128-
let mut child = std::process::Command::new(gix::path::env::exe_invocation())
129-
.args(["check-ignore", "--stdin", "-nv", "--no-index"])
130-
.stdin(std::process::Stdio::piped())
131-
.stdout(std::process::Stdio::piped())
132-
.stderr(std::process::Stdio::null())
133-
.current_dir(path)
134-
.spawn()?;
129+
let mut child =
130+
std::process::Command::from(gix::command::prepare(gix::path::env::exe_invocation()))
131+
.args(["check-ignore", "--stdin", "-nv", "--no-index"])
132+
.stdin(std::process::Stdio::piped())
133+
.stdout(std::process::Stdio::piped())
134+
.stderr(std::process::Stdio::null())
135+
.current_dir(path)
136+
.spawn()?;
135137

136138
std::thread::spawn({
137139
let mut stdin = child.stdin.take().expect("we configured it");

gitoxide-core/src/repository/commit.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ pub fn verify(repo: gix::Repository, rev_spec: Option<&str>) -> Result<()> {
2020
signature_storage.write_all(signature.as_ref())?;
2121
let signed_storage = signature_storage.into_temp_path();
2222

23-
let mut cmd = std::process::Command::new("gpg");
23+
let mut cmd: std::process::Command = gix::command::prepare("gpg").into();
2424
cmd.args(["--keyid-format=long", "--status-fd=1", "--verify"])
2525
.arg(&signed_storage)
2626
.arg("-")

gix-command/src/lib.rs

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -237,6 +237,13 @@ mod prepare {
237237
} else {
238238
Command::new(prep.command)
239239
};
240+
// We never want to have terminals pop-up on Windows if this runs from a GUI application.
241+
#[cfg(windows)]
242+
{
243+
use std::os::windows::process::CommandExt;
244+
const CREATE_NO_WINDOW: u32 = 0x08000000;
245+
cmd.creation_flags(CREATE_NO_WINDOW);
246+
}
240247
cmd.stdin(prep.stdin)
241248
.stdout(prep.stdout)
242249
.stderr(prep.stderr)
@@ -401,6 +408,8 @@ pub mod shebang {
401408
/// - `stdout` is captured for consumption by the caller
402409
/// - `stderr` is inherited to allow the command to provide context to the user
403410
///
411+
/// On Windows, terminal Windows will be suppressed automatically.
412+
///
404413
/// ### Warning
405414
///
406415
/// When using this method, be sure that the invoked program doesn't rely on the current working dir and/or

gix-credentials/src/program/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ impl Program {
7171
let git_program = gix_path::env::exe_invocation();
7272
let mut cmd = match &self.kind {
7373
Kind::Builtin => {
74-
let mut cmd = Command::new(git_program);
74+
let mut cmd = Command::from(gix_command::prepare(git_program));
7575
cmd.arg("credential").arg(action.as_arg(false));
7676
cmd
7777
}

gix-path/src/env/git/mod.rs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -82,6 +82,12 @@ pub(super) static EXE_NAME: &str = "git";
8282
pub(super) static EXE_INFO: Lazy<Option<BString>> = Lazy::new(|| {
8383
let git_cmd = |executable: PathBuf| {
8484
let mut cmd = Command::new(executable);
85+
#[cfg(windows)]
86+
{
87+
use std::os::windows::process::CommandExt;
88+
const CREATE_NO_WINDOW: u32 = 0x08000000;
89+
cmd.creation_flags(CREATE_NO_WINDOW);
90+
}
8591
cmd.args(["config", "-l", "--show-origin"])
8692
.stdin(Stdio::null())
8793
.stderr(Stdio::null());

gix-path/src/env/mod.rs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -109,6 +109,12 @@ pub fn system_prefix() -> Option<&'static Path> {
109109
}
110110

111111
let mut cmd = std::process::Command::new(exe_invocation());
112+
#[cfg(windows)]
113+
{
114+
use std::os::windows::process::CommandExt;
115+
const CREATE_NO_WINDOW: u32 = 0x08000000;
116+
cmd.creation_flags(CREATE_NO_WINDOW);
117+
}
112118
cmd.arg("--exec-path").stderr(std::process::Stdio::null());
113119
gix_trace::debug!(cmd = ?cmd, "invoking git to get system prefix/exec path");
114120
let path = cmd.output().ok()?.stdout;

0 commit comments

Comments
 (0)