[PR #431] Fix: Prevent console window popup when git-ai is called by TortoiseGit on Windows #464

Closed
opened 2026-03-02 04:13:42 +03:00 by kerem · 0 comments
Owner

Original Pull Request: https://github.com/git-ai-project/git-ai/pull/431

State: closed
Merged: Yes


Problem

When git-ai is configured with TortoiseGit on Windows, black console windows frequently pop up during git operations. This happens because git-ai spawns git subprocesses without the CREATE_NO_WINDOW flag, which causes Windows to create new console windows even when running in a non-interactive context.

Solution

This PR adds the CREATE_NO_WINDOW flag to all git subprocess spawns on Windows when running in a non-interactive terminal context. The fix uses the existing is_interactive_terminal() function from utils.rs to determine whether to hide the console window.

Changes

src/git/repository.rs

  • Added imports for is_interactive_terminal and CREATE_NO_WINDOW
  • Added Windows-specific CommandExt import
  • Modified exec_git() to apply CREATE_NO_WINDOW flag when not in interactive terminal
  • Modified exec_git_stdin() to apply CREATE_NO_WINDOW flag when not in interactive terminal
  • Modified exec_git_stdin_with_env() to apply CREATE_NO_WINDOW flag when not in interactive terminal

src/commands/git_handlers.rs

  • Added imports for is_interactive_terminal and CREATE_NO_WINDOW
  • Added Windows-specific CommandExt import
  • Modified proxy_to_git() to apply CREATE_NO_WINDOW flag when not in interactive terminal

Behavior

  • Interactive terminal: No change - console windows behave normally
  • Non-interactive terminal (e.g., TortoiseGit): Console windows are hidden, preventing the popup issue

Testing

To test this fix:

  1. Configure git-ai with TortoiseGit on Windows
  2. Perform git operations through TortoiseGit (commit, push, pull, etc.)
  3. Verify that no black console windows pop up during operations

Open with Devin
**Original Pull Request:** https://github.com/git-ai-project/git-ai/pull/431 **State:** closed **Merged:** Yes --- ## Problem When git-ai is configured with TortoiseGit on Windows, black console windows frequently pop up during git operations. This happens because git-ai spawns git subprocesses without the `CREATE_NO_WINDOW` flag, which causes Windows to create new console windows even when running in a non-interactive context. ## Solution This PR adds the `CREATE_NO_WINDOW` flag to all git subprocess spawns on Windows when running in a non-interactive terminal context. The fix uses the existing `is_interactive_terminal()` function from `utils.rs` to determine whether to hide the console window. ## Changes ### `src/git/repository.rs` - Added imports for `is_interactive_terminal` and `CREATE_NO_WINDOW` - Added Windows-specific `CommandExt` import - Modified `exec_git()` to apply `CREATE_NO_WINDOW` flag when not in interactive terminal - Modified `exec_git_stdin()` to apply `CREATE_NO_WINDOW` flag when not in interactive terminal - Modified `exec_git_stdin_with_env()` to apply `CREATE_NO_WINDOW` flag when not in interactive terminal ### `src/commands/git_handlers.rs` - Added imports for `is_interactive_terminal` and `CREATE_NO_WINDOW` - Added Windows-specific `CommandExt` import - Modified `proxy_to_git()` to apply `CREATE_NO_WINDOW` flag when not in interactive terminal ## Behavior - **Interactive terminal**: No change - console windows behave normally - **Non-interactive terminal** (e.g., TortoiseGit): Console windows are hidden, preventing the popup issue ## Testing To test this fix: 1. Configure git-ai with TortoiseGit on Windows 2. Perform git operations through TortoiseGit (commit, push, pull, etc.) 3. Verify that no black console windows pop up during operations <!-- devin-review-badge-begin --> --- <a href="https://app.devin.ai/review/git-ai-project/git-ai/pull/431" target="_blank"> <picture> <source media="(prefers-color-scheme: dark)" srcset="https://static.devin.ai/assets/gh-open-in-devin-review-dark.svg?v=1"> <img src="https://static.devin.ai/assets/gh-open-in-devin-review-light.svg?v=1" alt="Open with Devin"> </picture> </a> <!-- devin-review-badge-end -->
kerem 2026-03-02 04:13:42 +03:00
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/git-ai#464
No description provided.