Terminate a background shell and clean up all resources. Args: bash_id: The unique identifier of the background shell Returns: The terminated BackgroundShell object Raises: ValueError: If shell not found
(cls, bash_id: str)
| 189 | |
| 190 | @classmethod |
| 191 | async def terminate(cls, bash_id: str) -> BackgroundShell: |
| 192 | """Terminate a background shell and clean up all resources. |
| 193 | |
| 194 | Args: |
| 195 | bash_id: The unique identifier of the background shell |
| 196 | |
| 197 | Returns: |
| 198 | The terminated BackgroundShell object |
| 199 | |
| 200 | Raises: |
| 201 | ValueError: If shell not found |
| 202 | """ |
| 203 | shell = cls.get(bash_id) |
| 204 | if not shell: |
| 205 | raise ValueError(f"Shell not found: {bash_id}") |
| 206 | |
| 207 | # Terminate the process |
| 208 | await shell.terminate() |
| 209 | |
| 210 | # Clean up monitoring and remove from manager |
| 211 | cls._cancel_monitor(bash_id) |
| 212 | cls._remove(bash_id) |
| 213 | |
| 214 | return shell |
| 215 | |
| 216 | |
| 217 | class BashTool(Tool): |
nothing calls this directly
no test coverage detected