[Bug 1766068] Re: Using Zsh, it doesn't show an error message when command not found
Ricardo Pérez López
ricpelo at gmail.com
Sun Apr 22 15:05:40 UTC 2018
I've found the origin of the problem.
Since Zsh 5.3, the command_not_found_handler() behavior has changed, as
you can see here:
https://github.com/zsh-
users/zsh/blob/9e2afb92987d7fd96a838c15b6641cc1b634a825/README#L207-L214
Copy & paste:
6) Previously, if the function command_not_found_handler was run
in place of a command-not-found error, and the function returned
non-zero status, zsh set the status to 127 and printed an error message
anyway. Now, the status from the handler is retained and no additional
message is printed. The main reasons for this change are that it was not
possible to return a non-zero status to the parent shell from a command
executed as a replacement, and the new implementation is more consistent
with other shells.
So now, when you define a custom command_not_found_handler() function in
Zsh, the shell never print an error message by itself, i.e., the error
message must be printed by the handler function.
According to the above, I think the only solution is by remove the
'--no-failure-msg' option from the /etc/zsh_command_not_found and
therefore the command_not_found_handler() function is the only
responsible to print error messages to the user.
--
You received this bug notification because you are a member of Ubuntu
Foundations Bugs, which is subscribed to command-not-found in Ubuntu.
https://bugs.launchpad.net/bugs/1766068
Title:
Using Zsh, it doesn't show an error message when command not found
Status in command-not-found:
New
Status in command-not-found package in Ubuntu:
New
Bug description:
- Using latest Ubuntu Bionic, full updated.
- Using Zsh.
My ~/.zshrc includes the following line:
. /etc/zsh_command_not_found
When I type (for example):
$ sdlkfjslkdfjkdslf
it doesn't say nothing. No error message.
If I change the line #11 of /etc/zsh_command_not_found and I remove
'--no-failure-msg' option, then it works OK:
/usr/lib/command-not-found -- ${1+"$1"} && : (line 11, without --no-
failure-msg option)
I think the above option should be removed from
/etc/zsh_command_not_found.
To manage notifications about this bug go to:
https://bugs.launchpad.net/command-not-found/+bug/1766068/+subscriptions
More information about the foundations-bugs
mailing list