mirror of
https://github.com/SuperClaude-Org/SuperClaude_Framework.git
synced 2025-12-18 02:06:36 +00:00
fix: Windows PATH detection for CLI tools in PowerShell environments
- Add shell=True parameter to subprocess.run() calls on Windows platform - Fixes issue #128 where Claude CLI, Node.js, and npm were not detected in PowerShell - Affects validator.py and mcp.py components for better Windows compatibility - Resolves PowerShell PATH inheritance issues with Python subprocess 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
parent
f975070946
commit
b9fac065e0
@ -3,6 +3,7 @@ MCP component for MCP server integration
|
||||
"""
|
||||
|
||||
import subprocess
|
||||
import sys
|
||||
import json
|
||||
from typing import Dict, List, Tuple, Any
|
||||
from pathlib import Path
|
||||
@ -75,7 +76,8 @@ class MCPComponent(Component):
|
||||
["node", "--version"],
|
||||
capture_output=True,
|
||||
text=True,
|
||||
timeout=10
|
||||
timeout=10,
|
||||
shell=(sys.platform == "win32")
|
||||
)
|
||||
if result.returncode != 0:
|
||||
errors.append("Node.js not found - required for MCP servers")
|
||||
@ -99,7 +101,8 @@ class MCPComponent(Component):
|
||||
["claude", "--version"],
|
||||
capture_output=True,
|
||||
text=True,
|
||||
timeout=10
|
||||
timeout=10,
|
||||
shell=(sys.platform == "win32")
|
||||
)
|
||||
if result.returncode != 0:
|
||||
errors.append("Claude CLI not found - required for MCP server management")
|
||||
@ -115,7 +118,8 @@ class MCPComponent(Component):
|
||||
["npm", "--version"],
|
||||
capture_output=True,
|
||||
text=True,
|
||||
timeout=10
|
||||
timeout=10,
|
||||
shell=(sys.platform == "win32")
|
||||
)
|
||||
if result.returncode != 0:
|
||||
errors.append("npm not found - required for MCP server installation")
|
||||
@ -160,7 +164,8 @@ class MCPComponent(Component):
|
||||
["claude", "mcp", "list"],
|
||||
capture_output=True,
|
||||
text=True,
|
||||
timeout=15
|
||||
timeout=15,
|
||||
shell=(sys.platform == "win32")
|
||||
)
|
||||
|
||||
if result.returncode != 0:
|
||||
@ -218,7 +223,8 @@ class MCPComponent(Component):
|
||||
["claude", "mcp", "add", server_name, command],
|
||||
capture_output=True,
|
||||
text=True,
|
||||
timeout=120 # 2 minutes timeout for installation
|
||||
timeout=120, # 2 minutes timeout for installation
|
||||
shell=(sys.platform == "win32")
|
||||
)
|
||||
|
||||
if result.returncode == 0:
|
||||
@ -252,7 +258,8 @@ class MCPComponent(Component):
|
||||
["claude", "mcp", "remove", server_name],
|
||||
capture_output=True,
|
||||
text=True,
|
||||
timeout=60
|
||||
timeout=60,
|
||||
shell=(sys.platform == "win32")
|
||||
)
|
||||
|
||||
if result.returncode == 0:
|
||||
@ -328,7 +335,8 @@ class MCPComponent(Component):
|
||||
["claude", "mcp", "list"],
|
||||
capture_output=True,
|
||||
text=True,
|
||||
timeout=15
|
||||
timeout=15,
|
||||
shell=(sys.platform == "win32")
|
||||
)
|
||||
|
||||
if result.returncode == 0:
|
||||
@ -470,7 +478,8 @@ class MCPComponent(Component):
|
||||
["claude", "mcp", "list"],
|
||||
capture_output=True,
|
||||
text=True,
|
||||
timeout=15
|
||||
timeout=15,
|
||||
shell=(sys.platform == "win32")
|
||||
)
|
||||
|
||||
if result.returncode != 0:
|
||||
|
||||
@ -114,12 +114,13 @@ class Validator:
|
||||
return self.validation_cache[cache_key]
|
||||
|
||||
try:
|
||||
# Check if node is installed
|
||||
# Check if node is installed - use shell=True on Windows for better PATH resolution
|
||||
result = subprocess.run(
|
||||
['node', '--version'],
|
||||
capture_output=True,
|
||||
text=True,
|
||||
timeout=10
|
||||
timeout=10,
|
||||
shell=(sys.platform == "win32")
|
||||
)
|
||||
|
||||
if result.returncode != 0:
|
||||
@ -181,12 +182,13 @@ class Validator:
|
||||
return self.validation_cache[cache_key]
|
||||
|
||||
try:
|
||||
# Check if claude is installed
|
||||
# Check if claude is installed - use shell=True on Windows for better PATH resolution
|
||||
result = subprocess.run(
|
||||
['claude', '--version'],
|
||||
capture_output=True,
|
||||
text=True,
|
||||
timeout=10
|
||||
timeout=10,
|
||||
shell=(sys.platform == "win32")
|
||||
)
|
||||
|
||||
if result.returncode != 0:
|
||||
@ -254,7 +256,8 @@ class Validator:
|
||||
cmd_parts,
|
||||
capture_output=True,
|
||||
text=True,
|
||||
timeout=10
|
||||
timeout=10,
|
||||
shell=(sys.platform == "win32")
|
||||
)
|
||||
|
||||
if result.returncode != 0:
|
||||
@ -651,7 +654,8 @@ class Validator:
|
||||
["which" if sys.platform != "win32" else "where", tool],
|
||||
capture_output=True,
|
||||
text=True,
|
||||
timeout=5
|
||||
timeout=5,
|
||||
shell=(sys.platform == "win32")
|
||||
)
|
||||
if result.returncode == 0:
|
||||
tool_found = True
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user