Skip to content

Commit

Permalink
Merge pull request #628 from jeebak/develop
Browse files Browse the repository at this point in the history
Ensure that we're using the builtin exec
  • Loading branch information
ericfreese authored Sep 7, 2023
2 parents 23f2943 + 8072e52 commit 2c9e57f
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
6 changes: 3 additions & 3 deletions src/async.zsh
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ _zsh_autosuggest_async_request() {
# If we've got a pending request, cancel it
if [[ -n "$_ZSH_AUTOSUGGEST_ASYNC_FD" ]] && { true <&$_ZSH_AUTOSUGGEST_ASYNC_FD } 2>/dev/null; then
# Close the file descriptor and remove the handler
exec {_ZSH_AUTOSUGGEST_ASYNC_FD}<&-
builtin exec {_ZSH_AUTOSUGGEST_ASYNC_FD}<&-
zle -F $_ZSH_AUTOSUGGEST_ASYNC_FD

# We won't know the pid unless the user has zsh/system module installed
Expand All @@ -32,7 +32,7 @@ _zsh_autosuggest_async_request() {
fi

# Fork a process to fetch a suggestion and open a pipe to read from it
exec {_ZSH_AUTOSUGGEST_ASYNC_FD}< <(
builtin exec {_ZSH_AUTOSUGGEST_ASYNC_FD}< <(
# Tell parent process our pid
echo $sysparams[pid]
Expand Down Expand Up @@ -68,7 +68,7 @@ _zsh_autosuggest_async_response() {
zle autosuggest-suggest -- "$suggestion"

# Close the fd
exec {1}<&-
builtin exec {1}<&-
fi

# Always remove the handler
Expand Down
6 changes: 3 additions & 3 deletions zsh-autosuggestions.zsh
Original file line number Diff line number Diff line change
Expand Up @@ -768,7 +768,7 @@ _zsh_autosuggest_async_request() {
# If we've got a pending request, cancel it
if [[ -n "$_ZSH_AUTOSUGGEST_ASYNC_FD" ]] && { true <&$_ZSH_AUTOSUGGEST_ASYNC_FD } 2>/dev/null; then
# Close the file descriptor and remove the handler
exec {_ZSH_AUTOSUGGEST_ASYNC_FD}<&-
builtin exec {_ZSH_AUTOSUGGEST_ASYNC_FD}<&-
zle -F $_ZSH_AUTOSUGGEST_ASYNC_FD

# We won't know the pid unless the user has zsh/system module installed
Expand All @@ -789,7 +789,7 @@ _zsh_autosuggest_async_request() {
fi

# Fork a process to fetch a suggestion and open a pipe to read from it
exec {_ZSH_AUTOSUGGEST_ASYNC_FD}< <(
builtin exec {_ZSH_AUTOSUGGEST_ASYNC_FD}< <(
# Tell parent process our pid
echo $sysparams[pid]
Expand Down Expand Up @@ -825,7 +825,7 @@ _zsh_autosuggest_async_response() {
zle autosuggest-suggest -- "$suggestion"

# Close the fd
exec {1}<&-
builtin exec {1}<&-
fi

# Always remove the handler
Expand Down

0 comments on commit 2c9e57f

Please sign in to comment.