windows: Set CREATE_NO_WINDOW for commands (#18447)

- Closes: #18371

Release Notes:

- N/A
This commit is contained in:
张小白 2024-11-21 08:52:38 +08:00 committed by GitHub
parent 49ed932c1f
commit 95ace03706
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
31 changed files with 122 additions and 174 deletions

View file

@ -2,10 +2,6 @@ use crate::Oid;
use anyhow::{anyhow, Result};
use collections::HashMap;
use std::path::Path;
use std::process::Command;
#[cfg(windows)]
use std::os::windows::process::CommandExt;
pub fn get_messages(working_directory: &Path, shas: &[Oid]) -> Result<HashMap<Oid, String>> {
if shas.is_empty() {
@ -14,19 +10,12 @@ pub fn get_messages(working_directory: &Path, shas: &[Oid]) -> Result<HashMap<Oi
const MARKER: &str = "<MARKER>";
let mut command = Command::new("git");
command
let output = util::command::new_std_command("git")
.current_dir(working_directory)
.arg("show")
.arg("-s")
.arg(format!("--format=%B{}", MARKER))
.args(shas.iter().map(ToString::to_string));
#[cfg(windows)]
command.creation_flags(windows::Win32::System::Threading::CREATE_NO_WINDOW.0);
let output = command
.args(shas.iter().map(ToString::to_string))
.output()
.map_err(|e| anyhow!("Failed to start git blame process: {}", e))?;