Hello,
I've read on another discussion
(
http://www.zsh.org/mla/workers/2016/msg02049.html ) that the function command_not_found_handle is executed in a SUBSHELL.
May I ask why you've made this design decision? Is it possible to modify this behavior through bash options? (been searching but haven't found anything so far)
Since a normal function doesn't create subshell to be executed, wouldn't it be logical to let command_not_found_handle act the same way (if possible). If a user truly wishes to have command-not-found executed in subshell, they could always define so in command_not_found_handle.
I've been thinking about some workaround in which command_not_found_handle forwards all commands to be executed to stdin of it's parent process some way or another. But this idea is still very unstable... Don't know if this can be realised.
kind regards,
Dieter