Fix Windows MCP subprocess timeout for git detection (bd-r79z)
- Add shell=True for subprocess.run() on Windows platform - Improves git command PATH resolution on Windows - Add debug logging for git detection failures - Fixes GH#245 timeout issue where git rev-parse times out in MCP server Amp-Thread-ID: https://ampcode.com/threads/T-71b3ce65-87cb-451a-a30d-162d76d92f9c Co-authored-by: Amp <amp@ampcode.com>
This commit is contained in:
@@ -213,10 +213,12 @@ def _resolve_workspace_root(path: str) -> str:
|
||||
capture_output=True,
|
||||
text=True,
|
||||
check=False,
|
||||
shell=sys.platform == "win32",
|
||||
)
|
||||
if result.returncode == 0:
|
||||
return result.stdout.strip()
|
||||
except Exception:
|
||||
except Exception as e:
|
||||
logger.debug(f"Git detection failed for {path}: {e}")
|
||||
pass
|
||||
|
||||
return os.path.abspath(path)
|
||||
|
||||
@@ -1,14 +1,18 @@
|
||||
"""MCP tools for beads issue tracker."""
|
||||
|
||||
import asyncio
|
||||
import logging
|
||||
import os
|
||||
import subprocess
|
||||
import sys
|
||||
from contextvars import ContextVar
|
||||
from functools import lru_cache
|
||||
from typing import Annotated, TYPE_CHECKING
|
||||
|
||||
from .bd_client import create_bd_client, BdClientBase, BdError
|
||||
|
||||
logger = logging.getLogger(__name__)
|
||||
|
||||
if TYPE_CHECKING:
|
||||
from typing import List
|
||||
from .models import (
|
||||
@@ -75,10 +79,12 @@ def _resolve_workspace_root(path: str) -> str:
|
||||
capture_output=True,
|
||||
text=True,
|
||||
check=False,
|
||||
shell=sys.platform == "win32",
|
||||
)
|
||||
if result.returncode == 0:
|
||||
return result.stdout.strip()
|
||||
except Exception:
|
||||
except Exception as e:
|
||||
logger.debug(f"Git detection failed for {path}: {e}")
|
||||
pass
|
||||
|
||||
return os.path.abspath(path)
|
||||
|
||||
Reference in New Issue
Block a user