(command: str)
| 78 | return path |
| 79 | |
| 80 | def 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 | |
| 92 | def run_read(path: str, limit: int = None) -> str: |
| 93 | try: |
no test coverage detected