Test commit with fixed git.py v2
This commit is contained in:
10
git.py
10
git.py
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user