mirror of
https://github.com/bytedance/deer-flow.git
synced 2026-05-23 00:16:48 +00:00
fix(sandbox): disable msys path conversion (#2766)
This commit is contained in:
@@ -42,6 +42,13 @@ class LocalSandbox(Sandbox):
|
||||
"""Return whether the selected shell is cmd.exe."""
|
||||
return LocalSandbox._shell_name(shell) in {"cmd", "cmd.exe"}
|
||||
|
||||
@staticmethod
|
||||
def _is_msys_shell(shell: str) -> bool:
|
||||
"""Return whether the selected shell is a Git Bash/MSYS shell."""
|
||||
normalized = shell.replace("\\", "/").lower()
|
||||
shell_name = LocalSandbox._shell_name(shell)
|
||||
return shell_name in {"sh.exe", "bash.exe"} and any(part in normalized for part in ("/git/", "/mingw", "/msys"))
|
||||
|
||||
@staticmethod
|
||||
def _find_first_available_shell(candidates: tuple[str, ...]) -> str | None:
|
||||
"""Return the first executable shell path or command found from candidates."""
|
||||
@@ -303,12 +310,19 @@ class LocalSandbox(Sandbox):
|
||||
shell = self._get_shell()
|
||||
|
||||
if os.name == "nt":
|
||||
env = None
|
||||
if self._is_powershell(shell):
|
||||
args = [shell, "-NoProfile", "-Command", resolved_command]
|
||||
elif self._is_cmd_shell(shell):
|
||||
args = [shell, "/c", resolved_command]
|
||||
else:
|
||||
args = [shell, "-c", resolved_command]
|
||||
if self._is_msys_shell(shell):
|
||||
env = {
|
||||
**os.environ,
|
||||
"MSYS_NO_PATHCONV": "1",
|
||||
"MSYS2_ARG_CONV_EXCL": "*",
|
||||
}
|
||||
|
||||
result = subprocess.run(
|
||||
args,
|
||||
@@ -316,6 +330,7 @@ class LocalSandbox(Sandbox):
|
||||
capture_output=True,
|
||||
text=True,
|
||||
timeout=600,
|
||||
env=env,
|
||||
)
|
||||
else:
|
||||
args = [shell, "-c", resolved_command]
|
||||
|
||||
Reference in New Issue
Block a user