mafredri / zsh-async

Because your terminal should be able to perform tasks asynchronously without external tools!
MIT License
771 stars 35 forks source link

_async_zle_watcher is being called in an infinite loop if there is no callback set #38

Closed ackerleytng closed 4 years ago

ackerleytng commented 4 years ago

To reproduce:

  1. Start a shell with zsh-async loaded
  2. In the interactive shell, type async_start_worker test -n
  3. Send a command to the worker: async _job test 'sleep 0.1'
  4. Observe that the parent zsh process takes 100% CPU

Add an echo in _async_zle_watcher to confirm that _async_zle_watcher is indeed being called many times.

Could this lead to downstream issues?

mafredri commented 4 years ago

Thanks for reporting @ackerleytng, this has been fixed in 317d19ea817595e283370db5781f3d7a002b92a5. The issue surfaced when no callback function had been defined, preventing the output from being consumed and thus the ZLE watcher being called repeatedly. Not an issue when using callbacks and non-interactive terminals.