Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: Fixes infinite loop in auto install not found bash function #4094

Merged
merged 3 commits into from
Jan 15, 2025
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions src/shell/bash.rs
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ impl Shell for Bash {
{chpwd_load}
chpwd_functions+=(_mise_hook)
_mise_hook
"#,
"#,
chpwd_functions = include_str!("../assets/bash_zsh_support/chpwd/function.sh"),
chpwd_load = include_str!("../assets/bash_zsh_support/chpwd/load.sh")
});
Expand All @@ -71,7 +71,7 @@ impl Shell for Bash {
fi
command_not_found_handle() {{
if {exe} hook-not-found -s bash -- "$1"; then
if [ "$1" != "mise" ] && {exe} hook-not-found -s bash -- "$1"; then
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this should match this logic

&& (*env::MISE_BIN_NAME == mise_bin || env::MISE_BIN_NAME.starts_with("mise-"))
since "mise-foo" is a valid mise name

_mise_hook
"$@"
elif [ -n "$(declare -f _command_not_found_handle)" ]; then
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ if [ -z "${_mise_cmd_not_found:-}" ]; then
fi

command_not_found_handle() {
if /some/dir/mise hook-not-found -s bash -- "$1"; then
if [ "$1" != "mise" ] && /some/dir/mise hook-not-found -s bash -- "$1"; then
_mise_hook
"$@"
elif [ -n "$(declare -f _command_not_found_handle)" ]; then
Expand Down
Loading