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
Bugs, which is subscribed to Ubuntu.
https://bugs.launchpad.net/bugs/1766068

Title:
  Using Zsh, it doesn't show an error message when command not found

To manage notifications about this bug go to:
https://bugs.launchpad.net/command-not-found/+bug/1766068/+subscriptions

-- 
ubuntu-bugs mailing list
ubuntu-bugs@lists.ubuntu.com
https://lists.ubuntu.com/mailman/listinfo/ubuntu-bugs

Reply via email to