diff options
author | Peter Stephenson <pws@zsh.org> | 2016-10-05 12:14:43 +0100 |
---|---|---|
committer | Peter Stephenson <pws@zsh.org> | 2016-10-05 12:14:43 +0100 |
commit | dc517212caf3a8263cea9587bc6e96f7ff129b59 (patch) | |
tree | ab199c0936a8de2bc3c3e81661f7cee6b0e0c2d8 /Doc | |
parent | 429f8ae71dc7f84b799a6d0a1f96716a7cde8806 (diff) | |
download | zsh-dc517212caf3a8263cea9587bc6e96f7ff129b59.tar.gz zsh-dc517212caf3a8263cea9587bc6e96f7ff129b59.tar.xz zsh-dc517212caf3a8263cea9587bc6e96f7ff129b59.zip |
39566: Improve usefulness of command_not_found_handler.
Don't behave as if command not found if return status is non-zero as this may simply be the return status of the replacement command. Let the function report a command not found instead.
Diffstat (limited to 'Doc')
-rw-r--r-- | Doc/Zsh/exec.yo | 15 |
1 files changed, 8 insertions, 7 deletions
diff --git a/Doc/Zsh/exec.yo b/Doc/Zsh/exec.yo index 30e4a61a2..5f79967de 100644 --- a/Doc/Zsh/exec.yo +++ b/Doc/Zsh/exec.yo @@ -28,10 +28,11 @@ not handle this executable format in the kernel. If no external command is found but a function tt(command_not_found_handler) exists the shell executes this function with all -command line arguments. The function should return status zero if it -successfully handled the command, or non-zero status if it failed. -In the latter case the standard handling is applied: `command not -found' is printed to standard error and the shell exits with status 127. -Note that the handler is executed in a subshell forked to execute -an external command, hence changes to directories, shell parameters, -etc. have no effect on the main shell. +command line arguments. The return status of the function becomes the +status of the command. If the function wishes to mimic the +behaviour of the shell when the command is not found, it should +print the message `tt(command not found:) var(cmd)' to standard error +and return status 127. Note that the handler is executed in a +subshell forked to execute an external command, hence changes to +directories, shell parameters, etc. have no effect on the main shell. + |