修复windows下执行部分git命令没有带上CREATE_NO_WINDOW标识
This commit is contained in:
@@ -1,4 +1,5 @@
|
||||
use std::ffi::{OsStr, OsString};
|
||||
use std::process::Command;
|
||||
|
||||
#[cfg(windows)]
|
||||
use std::path::Path;
|
||||
@@ -6,6 +7,25 @@ use std::path::Path;
|
||||
#[cfg(windows)]
|
||||
const CREATE_NO_WINDOW: u32 = 0x0800_0000;
|
||||
|
||||
pub fn configure_std_command(command: &mut Command) -> &mut Command {
|
||||
#[cfg(windows)]
|
||||
{
|
||||
use std::os::windows::process::CommandExt;
|
||||
command.creation_flags(CREATE_NO_WINDOW);
|
||||
}
|
||||
|
||||
command
|
||||
}
|
||||
|
||||
pub fn std_command<S>(program: S) -> Command
|
||||
where
|
||||
S: AsRef<OsStr>,
|
||||
{
|
||||
let mut command = Command::new(normalized_program(program));
|
||||
configure_std_command(&mut command);
|
||||
command
|
||||
}
|
||||
|
||||
pub fn configure_tokio_command(
|
||||
command: &mut tokio::process::Command,
|
||||
) -> &mut tokio::process::Command {
|
||||
|
||||
Reference in New Issue
Block a user