Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

zsh command_not_found_handler vs bash command_not_found_handle



Hi all,

Some while ago, I documented [1] the minor changes in zsh
command_not_found_handler, compared to the bash
command_not_found_handle mechanism:
- If the handler returns non-zero, zsh itself returns 127, regardless
- If the handler returns non-zero, zsh itself prints the 'command not
found' message.

This behaviour does not distinguish between the handler and the
installed/substituted program returning non-zero. This is handled
better in bash, where:
- Regardless of the handler's return code, bash returns it. This
allows the user to distinguish between 127 - something went wrong with
the handler code, or anything else, from the called program.
- It is the handler that is responsible for printing the error code.
The handler has better knowledge of what went wrong.

Do you consider changing this behaviour, to match functionality with
bash? It would also simplify writing the handler.

Kind regards
Tim

[1] https://bugzilla.redhat.com/show_bug.cgi?id=1358372



Messages sorted by: Reverse Date, Date, Thread, Author