Test commit with fixed git.py v2

This commit is contained in:
2026-01-11 18:40:39 +08:00
parent 1ddd49f913
commit 2738a822d1
2 changed files with 10 additions and 0 deletions

10
git.py
View File

@@ -11,6 +11,16 @@ from datetime import datetime
def run_command(cmd, cwd=None):
"""Run a shell command and return output."""
# On Windows, if cmd starts with 'git', we need to use the full path to avoid conflict with git.py
if sys.platform == "win32" and cmd.strip().startswith("git "):
# Use full path to git.exe with proper quoting
git_exe = r'"C:\Program Files\Git\bin\git.exe"'
if os.path.exists(git_exe.strip('"')):
# Replace 'git' with the full path
parts = cmd.split(" ", 1)
if parts[0] == "git":
cmd = f'{git_exe} {parts[1]}' if len(parts) > 1 else git_exe
try:
result = subprocess.run(cmd, shell=True, capture_output=True, text=True, cwd=cwd)
return result.returncode, result.stdout, result.stderr