Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update zsh-async to v1.8.4 #566

Merged
merged 2 commits into from
Sep 23, 2020
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
37 changes: 24 additions & 13 deletions async.zsh
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,12 @@
#
# zsh-async
#
# version: 1.8.0
# version: v1.8.4
# author: Mathias Fredriksson
# url: https://github.com/mafredri/zsh-async
#

typeset -g ASYNC_VERSION=1.8.0
typeset -g ASYNC_VERSION=1.8.4
# Produce debug output from zsh-async when set to 1.
typeset -g ASYNC_DEBUG=${ASYNC_DEBUG:-0}

Expand Down Expand Up @@ -531,7 +531,7 @@ async_flush_jobs() {
# -p pid to notify (defaults to current pid)
#
async_start_worker() {
setopt localoptions noshwordsplit
setopt localoptions noshwordsplit noclobber

local worker=$1; shift
local -a args
Expand All @@ -542,13 +542,6 @@ async_start_worker() {
typeset -h REPLY
typeset has_xtrace=0

# Make sure async worker is started without xtrace
# (the trace output interferes with the worker).
[[ -o xtrace ]] && {
has_xtrace=1
unsetopt xtrace
}

if [[ -o interactive ]] && [[ -o zle ]]; then
# Inform the worker to ignore the notify flag and that we're
# using a ZLE watcher instead.
Expand All @@ -563,13 +556,31 @@ async_start_worker() {
fi
fi

zpty -b $worker _async_worker -p $$ $args || {
async_stop_worker $worker
return 1
# Workaround for stderr in the main shell sometimes (incorrectly) being
# reassigned to /dev/null by the reassignment done inside the async
# worker.
# See https://github.com/mafredri/zsh-async/issues/35.
integer errfd=-1
exec {errfd}>&2

# Make sure async worker is started without xtrace
# (the trace output interferes with the worker).
[[ -o xtrace ]] && {
has_xtrace=1
unsetopt xtrace
}

zpty -b $worker _async_worker -p $$ $args 2>&$errfd
local ret=$?

# Re-enable it if it was enabled, for debugging.
(( has_xtrace )) && setopt xtrace
exec {errfd}>& -

if (( ret )); then
async_stop_worker $worker
return 1
fi

if ! is-at-least 5.0.8; then
# For ZSH versions older than 5.0.8 we delay a bit to give
Expand Down