Skip to content

Commit

Permalink
Workaround for main shell stderr being reassigned to /dev/null
Browse files Browse the repository at this point in the history
Fixes #35.
  • Loading branch information
mafredri committed May 14, 2020
1 parent a9ca051 commit 8ce4ed6
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion async.zsh
Original file line number Diff line number Diff line change
Expand Up @@ -563,10 +563,16 @@ async_start_worker() {
fi
fi

zpty -b $worker _async_worker -p $$ $args || {
# 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.
exec {errfd}>&2
zpty -b $worker _async_worker -p $$ $args 2>&$errfd || {
async_stop_worker $worker
return 1
}
exec {errfd}>& -

# Re-enable it if it was enabled, for debugging.
(( has_xtrace )) && setopt xtrace
Expand Down

0 comments on commit 8ce4ed6

Please sign in to comment.