about summary refs log tree commit diff
path: root/Functions/MIME/zsh-mime-handler
diff options
context:
space:
mode:
authorPeter Stephenson <pws@zsh.org>2013-08-29 10:48:49 +0100
committerPeter Stephenson <pws@zsh.org>2013-08-29 10:48:49 +0100
commit1c9931cc7d37cac9aebb034444fb87e0901e914a (patch)
treef77c576ffa6f50364dc9e33480ad9a821f9c1c96 /Functions/MIME/zsh-mime-handler
parent1a4730b8eecc8f0b098203d79b787799770da179 (diff)
downloadzsh-1c9931cc7d37cac9aebb034444fb87e0901e914a.tar.gz
zsh-1c9931cc7d37cac9aebb034444fb87e0901e914a.tar.xz
zsh-1c9931cc7d37cac9aebb034444fb87e0901e914a.zip
users/17955: new "disown" style for MIME handlers.
Makes handlers put into the background run without job control.
Diffstat (limited to 'Functions/MIME/zsh-mime-handler')
-rw-r--r--Functions/MIME/zsh-mime-handler9
1 files changed, 6 insertions, 3 deletions
diff --git a/Functions/MIME/zsh-mime-handler b/Functions/MIME/zsh-mime-handler
index abaf0b6e3..7245c20e2 100644
--- a/Functions/MIME/zsh-mime-handler
+++ b/Functions/MIME/zsh-mime-handler
@@ -74,7 +74,7 @@ if [[ $suffix != *.* ]]; then
 fi
 suffix=${suffix#*.}
 
-local handler flags no_sh no_bg arg
+local handler flags no_sh no_bg arg bg_flag="&"
 integer i
 local -a exec_asis hand_nonex
 
@@ -89,6 +89,9 @@ zsh-mime-contexts -a $suffix execute-as-is exec_asis || exec_asis=('*(*)' '*(/)'
 zsh-mime-contexts -a $suffix handle-nonexistent hand_nonex ||
   hand_nonex=('[[:alpha:]]#:/*')
 
+# Set to true if the job should be disowned.
+zsh-mime-contexts -t $suffix disown && bg_flag="&!"
+
 local pattern
 local -a files
 
@@ -309,8 +312,8 @@ else
   # Otherwise it's equivalent to removing the eval and all the quotes,
   # including the (q) flags.
   if [[ -n $stdin ]]; then
-    eval cat ${(q)argv} "|" ${(q)execargs} "&"
+    eval cat ${(q)argv} "|" ${(q)execargs} $bg_flag
   else
-    eval ${(q)execargs} "&"
+    eval ${(q)execargs} $bg_flag
   fi
 fi