You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I was able to successfully get the correct response from tool.run_shell_command(["grep", "-i", "text", "file.txt"])
using the current implementation.
Would you like to share your exact test snippet and dir tree where your file.txt is located so we can investigate this further?
#3217)
## Summary
Refactored ShellTools.run_shell_command to correctly handle working
directory changes by using the cwd parameter of subprocess.run() instead
of prepending cd to the shell command. This resolves command execution
failures caused by improper shell syntax in argument lists and improves
robustness and cross-platform compatibility.
issue number: #3218
Description
The ShellTools.run_shell_command method attempts to change the working directory by prepending ["cd",
, ";"] to the command when building the argument list passed to subprocess.run(). This approach is invalid and leads to silent command failures.Root Cause
Steps to Reproduce
tool = ShellTools("/some/path")
tool.run_shell_command(["grep", "-i", "text", "file.txt"])
Agent Configuration (if applicable)
No response
Expected Behavior
The command should be executed in the desired working directory and return actual results, e.g., running grep on a file in that directory.
Actual Behavior
Screenshots or Logs (if applicable)
No response
Environment
- OS: MAcOS
Possible Solutions (optional)
#3217
Additional Context
No response
The text was updated successfully, but these errors were encountered: