diff .zfun/async @ 497:2ea29b487b06

zsh: update async to 1.8.5
author Augie Fackler <raf@durin42.com>
date Tue, 29 Sep 2020 11:11:09 -0400
parents d3d52766cfcd
children
line wrap: on
line diff
--- a/.zfun/async
+++ b/.zfun/async
@@ -3,12 +3,12 @@
 #
 # zsh-async
 #
-# version: v1.8.4
+# version: v1.8.5
 # author: Mathias Fredriksson
 # url: https://github.com/mafredri/zsh-async
 #
 
-typeset -g ASYNC_VERSION=1.8.4
+typeset -g ASYNC_VERSION=1.8.5
 # Produce debug output from zsh-async when set to 1.
 typeset -g ASYNC_DEBUG=${ASYNC_DEBUG:-0}
 
@@ -561,7 +561,11 @@ async_start_worker() {
 	# worker.
 	# See https://github.com/mafredri/zsh-async/issues/35.
 	integer errfd=-1
-	exec {errfd}>&2
+
+	# Redirect of errfd is broken on zsh 5.0.2.
+	if is-at-least 5.0.8; then
+		exec {errfd}>&2
+	fi
 
 	# Make sure async worker is started without xtrace
 	# (the trace output interferes with the worker).
@@ -570,12 +574,16 @@ async_start_worker() {
 		unsetopt xtrace
 	}
 
-	zpty -b $worker _async_worker -p $$ $args 2>&$errfd
+	if (( errfd != -1 )); then
+		zpty -b $worker _async_worker -p $$ $args 2>&$errfd
+	else
+		zpty -b $worker _async_worker -p $$ $args
+	fi
 	local ret=$?
 
 	# Re-enable it if it was enabled, for debugging.
 	(( has_xtrace )) && setopt xtrace
-	exec {errfd}>& -
+	(( errfd != -1 )) && exec {errfd}>& -
 
 	if (( ret )); then
 		async_stop_worker $worker