feat(shell): add background command execution with output redirection and timeout support

This commit is contained in:
Soulter
2026-04-27 13:43:55 +08:00
parent 09ab45fcb5
commit 77040cabcd
2 changed files with 71 additions and 2 deletions

View File

@@ -0,0 +1,15 @@
from astrbot.core.tools.computer_tools.shell import (
_redirect_background_stdout_command,
)
def test_background_shell_command_redirects_output_to_file():
command = _redirect_background_stdout_command(
"python -c 'print(123)'",
output_path="/tmp/astrbot shell output.log",
local_runtime=False,
)
assert command == (
"python -c 'print(123)' > \"/tmp/astrbot shell output.log\" 2>&1"
)