Commit graph

3 commits

Author SHA1 Message Date
Loïc Yhuel
42b22ecf7d fix(async): avoid blocking the shell while waiting
Due to "builtin echo $handler", _omz_async_callback was called immediately, as there was data to
read on the pipe. Then the shell was blocked until the end of the async prompt handler.
We now use associative array to get the handler name from the fd.

For an unknown reason, the async child can block when launching a subshell, especially if there are
several handlers registered.
Using a function to set the return code avoids the issue, and is much faster.

Fixes #12290
2024-03-25 23:37:15 +01:00
Marc Cornellà
06753e8146
fix(async): register the git prompt async handler correctly (#12267)
This fix conditionally registers the git prompt async handler only
if `git_prompt_info` is used anywhere in the prompt variables.

This is done in the proper order, so that the async request is
processed once the handler has been registered.

This fix also passes the return value of the previous command
to each of the async handlers, in case they are needed.
2024-03-09 18:29:53 +01:00
Marc Cornellà
083cc2c8e8
feat(async)!: implement async prompt API and apply to git prompt (#12257)
BREAKING CHANGE: the `git_prompt_info` prompt function has been
reworked by default to use the new async prompt feature. If you're
experiencing issues see #12257.

Co-authored-by: Carlo Sala <carlosalag@protonmail.com>
2024-03-07 14:39:05 +01:00