fix(tools): preserve PATH for argument-vector commands

This commit is contained in:
chengyongru authored and chengyongru committed 2026-09-30 13:09:30 +08:00
1 parent 99ba062a97
commit 54d85059a5
2 files changed
+29 -2

No files matched your search

+5 -2
View File
@@ -475,8 +475,11 @@ class ExecTool(Tool):
effective_timeout = self._resolve_timeout(timeout)
env = self._build_env()
if self.path_prepend or self.path_append:
if _IS_WINDOWS or isinstance(command, list):
if isinstance(command, list):
parent_path = os.environ.get("PATH", env.get("PATH", ""))
env["PATH"] = self._compose_path(parent_path)
elif self.path_prepend or self.path_append:
if _IS_WINDOWS:
env["PATH"] = self._compose_path(env.get("PATH", ""))
else:
command = self._wrap_path_export(command, env)