kubectl-ai
kubectl-ai copied to clipboard
fix(tools): Use exec.LookPath to find bash executable before running bash commands
Fixes #228
Find the bash executable using exec.LookPath instead of hardcoding /bin/bash. Falls back to /bin/bash if not found in PATH. Improves compatibility on systems where bash might be installed in a non-standard location.
On some systems (e.g. NixOS), executables might not be in standard locations like /bin/bash.
Thanks for your pull request! It looks like this may be your first contribution to a Google open source project. Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA).
View this failed invocation of the CLA check for more information.
For the most up to date status, view the checks section at the bottom of the pull request.
Currently I modified the bashBin in bash_tool.go in init function directly, if you think it's not a good choice and prefer passing the bash command path using parameters, or using other ways, please that me know.
Currently I modified the
bashBinin bash_tool.go in init function directly, if you think it's not a good choice and prefer passing the bash command path using parameters, or using other ways, please that me know.
Would prefer to keep init() side-effect free, suggested to move it closer to command construction. and its okay to duplicate code if needed.
Thanks @ruinshe you will need to rebase the PR because we had to update the presubmits, sorry :(
Thanks @ruinshe you will need to rebase the PR because we had to update the presubmits, sorry :(
done