Skip to content

Commit

Permalink
fix bash command not found override
Browse files Browse the repository at this point in the history
Fixes #1558
Fixes #1563
  • Loading branch information
jdx committed Jan 31, 2024
1 parent 7f900c4 commit d7b9183
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
3 changes: 2 additions & 1 deletion src/shell/bash.rs
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,8 @@ impl Shell for Bash {
out.push_str(&formatdoc! {r#"
if [ -z "${{_mise_cmd_not_found:-}}" ]; then
_mise_cmd_not_found=1
[ -n "$(declare -f command_not_found_handle)" ] && eval "${{$(declare -f command_not_found_handle)/command_not_found_handle/_command_not_found_handle}}"
_mise_cmd_not_found_handle=$(declare -f command_not_found_handle)
[ -n "$_mise_cmd_not_found_handle" ] && eval "${{_mise_cmd_not_found_handle/command_not_found_handle/_command_not_found_handle}}"
command_not_found_handle() {{
if {exe} hook-not-found -s bash -- "$1"; then
Expand Down
3 changes: 2 additions & 1 deletion src/shell/snapshots/mise__shell__bash__tests__activate.snap
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,8 @@ if [[ ";${PROMPT_COMMAND:-};" != *";_mise_hook;"* ]]; then
fi
if [ -z "${_mise_cmd_not_found:-}" ]; then
_mise_cmd_not_found=1
[ -n "$(declare -f command_not_found_handle)" ] && eval "${$(declare -f command_not_found_handle)/command_not_found_handle/_command_not_found_handle}"
_mise_cmd_not_found_handle=$(declare -f command_not_found_handle)
[ -n "$_mise_cmd_not_found_handle" ] && eval "${_mise_cmd_not_found_handle/command_not_found_handle/_command_not_found_handle}"

command_not_found_handle() {
if /some/dir/mise hook-not-found -s bash -- "$1"; then
Expand Down

0 comments on commit d7b9183

Please sign in to comment.