fix(shell): preserve login PATH for path append
Made-with: Cursor
This commit is contained in:
@@ -135,7 +135,11 @@ class ExecTool(Tool):
|
||||
env = self._build_env()
|
||||
|
||||
if self.path_append:
|
||||
env["PATH"] = env.get("PATH", "") + os.pathsep + self.path_append
|
||||
if _IS_WINDOWS:
|
||||
env["PATH"] = env.get("PATH", "") + os.pathsep + self.path_append
|
||||
else:
|
||||
env["NANOBOT_PATH_APPEND"] = self.path_append
|
||||
command = f'export PATH="$PATH{os.pathsep}$NANOBOT_PATH_APPEND"; {command}'
|
||||
|
||||
try:
|
||||
process = await self._spawn(command, cwd, env)
|
||||
@@ -255,7 +259,6 @@ class ExecTool(Tool):
|
||||
home = os.environ.get("HOME", "/tmp")
|
||||
env = {
|
||||
"HOME": home,
|
||||
"PATH": os.environ.get ("PATH", "/usr/bin:/bin"),
|
||||
"LANG": os.environ.get("LANG", "C.UTF-8"),
|
||||
"TERM": os.environ.get("TERM", "dumb"),
|
||||
}
|
||||
@@ -296,8 +299,8 @@ class ExecTool(Tool):
|
||||
continue
|
||||
|
||||
media_path = get_media_dir().resolve()
|
||||
if (p.is_absolute()
|
||||
and cwd_path not in p.parents
|
||||
if (p.is_absolute()
|
||||
and cwd_path not in p.parents
|
||||
and p != cwd_path
|
||||
and media_path not in p.parents
|
||||
and p != media_path
|
||||
|
||||
Reference in New Issue
Block a user