MCPcopy Create free account
hub / github.com/FastLED/FastLED / run_command

Function run_command

mcp_server.py:2864–2882  ·  view source on GitHub ↗

Run a shell command and return its output.

(cmd: list[str], cwd: Path)

Source from the content-addressed store, hash-verified

2862
2863
2864async def run_command(cmd: list[str], cwd: Path) -> str:
2865 """Run a shell command and return its output."""
2866 try:
2867 process = await asyncio.create_subprocess_exec(
2868 *cmd,
2869 cwd=cwd,
2870 stdout=asyncio.subprocess.PIPE,
2871 stderr=asyncio.subprocess.STDOUT,
2872 )
2873
2874 stdout_bytes, _ = await process.communicate()
2875 stdout = stdout_bytes.decode("utf-8", errors="replace") if stdout_bytes else ""
2876
2877 if process.returncode != 0:
2878 return f"Command failed with exit code {process.returncode}:\n{stdout}"
2879
2880 return stdout
2881 except Exception as e:
2882 return f"Error running command: {str(e)}"
2883
2884
2885async def main():

Callers 9

run_testsFunction · 0.70
setup_stack_tracesFunction · 0.70
compile_examplesFunction · 0.70
lint_codeFunction · 0.70
project_infoFunction · 0.70
run_specific_commandFunction · 0.70
validate_completionFunction · 0.70
symbol_analysisFunction · 0.70

Calls 2

communicateMethod · 0.80
decodeMethod · 0.45

Tested by

no test coverage detected