about summary refs log tree commit diff
path: root/Completion
diff options
context:
space:
mode:
authorBarton E. Schaefer <schaefer@zsh.org>2014-09-23 20:31:31 -0700
committerBarton E. Schaefer <schaefer@zsh.org>2014-09-23 20:31:31 -0700
commit5a2668a6ac1c433337a4db8bc859b712be6b32f1 (patch)
tree701b3f507e86f2e4364b42e344d27fbbf9bfa489 /Completion
parent95a6d965c556807a7aa16490f92f48b77bf8b6ce (diff)
downloadzsh-5a2668a6ac1c433337a4db8bc859b712be6b32f1.tar.gz
zsh-5a2668a6ac1c433337a4db8bc859b712be6b32f1.tar.xz
zsh-5a2668a6ac1c433337a4db8bc859b712be6b32f1.zip
33223: discard stderr except when _complete_debug is in progress.
Diffstat (limited to 'Completion')
-rw-r--r--Completion/Base/Utility/_call_program17
1 files changed, 15 insertions, 2 deletions
diff --git a/Completion/Base/Utility/_call_program b/Completion/Base/Utility/_call_program
index b038a80bc..b65764827 100644
--- a/Completion/Base/Utility/_call_program
+++ b/Completion/Base/Utility/_call_program
@@ -1,6 +1,13 @@
 #autoload +X
 
-local tmp
+local tmp err_fd=-1
+
+if (( ${debug_fd:--1} > 2 ))
+then exec {err_fd}>&2	# debug_fd is saved stderr, 2 is log file
+else exec {err_fd}>/dev/null
+fi
+
+{	# Begin "always" block
 
 if zstyle -s ":completion:${curcontext}:${1}" command tmp; then
   if [[ "$tmp" = -* ]]; then
@@ -10,4 +17,10 @@ if zstyle -s ":completion:${curcontext}:${1}" command tmp; then
   fi
 else
   eval "$argv[2,-1]"
-fi
+fi 2>&$err_fd
+
+} always {
+
+exec {err_fd}>&-
+
+}