mirror of
https://github.com/jj-vcs/jj.git
synced 2025-12-23 06:01:01 +00:00
git: Don't show console on Windows
When used inside GUI application, git.subprocess=true option causes console window to appear temporarily. std::process::Command needs special flags to prevent that. More details: https://stackoverflow.com/a/60958956
This commit is contained in:
parent
bdbb7afbbb
commit
a028e4a03a
1 changed files with 8 additions and 0 deletions
|
|
@ -105,6 +105,14 @@ impl<'a> GitSubprocessContext<'a> {
|
|||
/// Create the Git command
|
||||
fn create_command(&self) -> Command {
|
||||
let mut git_cmd = Command::new(self.git_executable_path);
|
||||
// Hide console window on Windows (https://stackoverflow.com/a/60958956)
|
||||
#[cfg(windows)]
|
||||
{
|
||||
use std::os::windows::process::CommandExt;
|
||||
const CREATE_NO_WINDOW: u32 = 0x08000000;
|
||||
git_cmd.creation_flags(CREATE_NO_WINDOW);
|
||||
}
|
||||
|
||||
// TODO: here we are passing the full path to the git_dir, which can lead to UNC
|
||||
// bugs in Windows. The ideal way to do this is to pass the workspace
|
||||
// root to Command::current_dir and then pass a relative path to the git
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue