about summary refs log tree commit diff
path: root/Completion/compinit
diff options
context:
space:
mode:
authorSven Wischnowsky <wischnow@users.sourceforge.net>2001-05-29 11:59:50 +0000
committerSven Wischnowsky <wischnow@users.sourceforge.net>2001-05-29 11:59:50 +0000
commit4a7abbfdd6c68616143bae840333adeed5ad0066 (patch)
tree2bc3f4bf439c78ee7e1135361bc86d2d708c0125 /Completion/compinit
parent1bb5d5aeb5565215aa3359874d7701045926b1b7 (diff)
downloadzsh-4a7abbfdd6c68616143bae840333adeed5ad0066.tar.gz
zsh-4a7abbfdd6c68616143bae840333adeed5ad0066.tar.xz
zsh-4a7abbfdd6c68616143bae840333adeed5ad0066.zip
use `eval $_comp_setup' in all entry points of the completion system to not only set up the options, but also redirect stdin and ignore trap handlers for ZERR (14530)
Diffstat (limited to 'Completion/compinit')
-rw-r--r--Completion/compinit11
1 files changed, 11 insertions, 0 deletions
diff --git a/Completion/compinit b/Completion/compinit
index 05ef2c379..4b85be764 100644
--- a/Completion/compinit
+++ b/Completion/compinit
@@ -139,8 +139,19 @@ _comp_options=(
     NO_cshnullglob
     NO_allexport
     NO_aliases
+    NO_errexit
 )
 
+# And this one should be `eval'ed at the beginning of every entry point
+# to the completion system.  It sets up what we currently consider a
+# sane environment.  That means we set the options above, make sure we
+# have a valid stdin descriptor (zle closes it before calling widgets)
+# and don't get confused by user's ZERR trap handlers.
+
+_comp_setup='setopt localoptions localtraps ${_comp_options[@]};
+             exec </dev/null;
+             trap - ZERR'
+
 # These can hold names of functions that are to be called before/after all
 # matches have been generated.