summary refs log tree commit diff
path: root/Completion/Base/Utility
diff options
context:
space:
mode:
Diffstat (limited to 'Completion/Base/Utility')
-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}>&-
+
+}