MCPcopy Index your code
hub / github.com/shareAI-lab/learn-claude-code / run_bash

Function run_bash

agents/s_full.py:80–90  ·  view source on GitHub ↗
(command: str)

Source from the content-addressed store, hash-verified

78 return path
79
80def run_bash(command: str) -> str:
81 dangerous = ["rm -rf /", "sudo", "shutdown", "reboot", "> /dev/"]
82 if any(d in command for d in dangerous):
83 return "Error: Dangerous command blocked"
84 try:
85 r = subprocess.run(command, shell=True, cwd=WORKDIR,
86 capture_output=True, text=True, timeout=120)
87 out = (r.stdout + r.stderr).strip()
88 return out[:50000] if out else "(no output)"
89 except subprocess.TimeoutExpired:
90 return "Error: Timeout (120s)"
91
92def run_read(path: str, limit: int = None) -> str:
93 try:

Callers 3

run_subagentFunction · 0.70
_loopMethod · 0.70
s_full.pyFile · 0.70

Calls 1

runMethod · 0.45

Tested by

no test coverage detected