9d529c41cc82580d0a947ce8bcf5ff7775585fe5

Author
Loïc Yhuel <loic.yhuel@gmail.com>
Committer
GitHub <noreply@github.com>
Date

Message

perf(async): avoid executing `true` if not required (#12318)

The issue which required "command true" was fixed in zsh 5.8.

Diff

 1diff --git a/lib/async_prompt.zsh b/lib/async_prompt.zsh
 2index ac95bcd73c031525df9d456e2adbf6717ad92eb1..a83c57f35327f4f3051a7db69f0a7f4765ed91ab 100644
 3--- a/lib/async_prompt.zsh
 4+++ b/lib/async_prompt.zsh
 5@@ -3,6 +3,7 @@
 6 # https://github.com/woefe/git-prompt.zsh/blob/master/git-prompt.zsh
 7 
 8 zmodload zsh/system
 9+autoload -Uz is-at-least
10 
11 # For now, async prompt function handlers are set up like so:
12 # First, define the async function handler and register the handler
13@@ -93,7 +94,8 @@ function _omz_async_request {
14 
15     # There's a weird bug here where ^C stops working unless we force a fork
16     # See https://github.com/zsh-users/zsh-autosuggestions/issues/364
17-    command true
18+    # and https://github.com/zsh-users/zsh-autosuggestions/pull/612
19+    is-at-least 5.8 || command true
20 
21     # Save the PID from the handler child process
22     read -u $fd "_OMZ_ASYNC_PIDS[$handler]"