mirror of
https://github.com/HKUDS/nanobot.git
synced 2026-05-22 09:32:33 +00:00
fix(exec): stabilize Windows shell tests
This commit is contained in:
parent
ccbc0bb6e3
commit
835bab5f5a
@ -414,7 +414,8 @@ class ExecTool(Tool):
|
|||||||
)
|
)
|
||||||
shell_program = shell_program or shutil.which("bash") or "/bin/bash"
|
shell_program = shell_program or shutil.which("bash") or "/bin/bash"
|
||||||
args = [shell_program]
|
args = [shell_program]
|
||||||
if login and Path(shell_program).name in {"bash", "zsh"}:
|
shell_name = Path(shell_program).name.lower()
|
||||||
|
if login and shell_name in {"bash", "bash.exe", "zsh", "zsh.exe"}:
|
||||||
args.append("-l")
|
args.append("-l")
|
||||||
args.extend(["-c", command])
|
args.extend(["-c", command])
|
||||||
return await asyncio.create_subprocess_exec(
|
return await asyncio.create_subprocess_exec(
|
||||||
|
|||||||
@ -37,7 +37,10 @@ def test_exec_keeps_one_shot_behavior_without_yield_time_ms(tmp_path):
|
|||||||
def test_exec_accepts_command_aliases(tmp_path):
|
def test_exec_accepts_command_aliases(tmp_path):
|
||||||
async def run() -> str:
|
async def run() -> str:
|
||||||
tool = ExecTool(working_dir="/")
|
tool = ExecTool(working_dir="/")
|
||||||
return await tool.execute(cmd="pwd", workdir=str(tmp_path))
|
return await tool.execute(
|
||||||
|
cmd=_python_command("import os; print(os.getcwd())"),
|
||||||
|
workdir=str(tmp_path),
|
||||||
|
)
|
||||||
|
|
||||||
result = asyncio.run(run())
|
result = asyncio.run(run())
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user