mirror of
https://github.com/AstrBotDevs/AstrBot
synced 2026-07-16 01:40:15 +08:00
* feat(shell): add background command execution with output redirection and timeout support * feat(shell): update timeout parameter to be optional in shell execution methods * feat(shell): set default timeout for shell execution to 10,000,000 milliseconds * feat(shell): set default timeout to 300s for shell execution * feat(shell): reorder timeout parameter in ExecuteShellTool configuration * feat(shell): implement background command execution with detached shell command support Co-authored-by: Copilot <copilot@github.com> * test(shell): remove obsolete test for background shell command output redirection * fix: reorder import statements in shell.py for consistency * fix: wrap command in parentheses for background output redirection --------- Co-authored-by: Copilot <copilot@github.com>
22 lines
431 B
Python
22 lines
431 B
Python
"""
|
|
Shell component
|
|
"""
|
|
|
|
from typing import Any, Protocol
|
|
|
|
|
|
class ShellComponent(Protocol):
|
|
"""Shell operations component"""
|
|
|
|
async def exec(
|
|
self,
|
|
command: str,
|
|
cwd: str | None = None,
|
|
env: dict[str, str] | None = None,
|
|
timeout: int | None = 300,
|
|
shell: bool = True,
|
|
background: bool = False,
|
|
) -> dict[str, Any]:
|
|
"""Execute shell command"""
|
|
...
|