Zsh prompt latency and background job notification limits
0 reputation · 02 Aug 2024, 23:43 UTC
Managing asynchronous process notifications in zsh often involves using the precmd hook to check the status of background jobs before rendering the prompt. This ensures the user is alerted to command completion without requiring constant polling or intrusive noise.
However, as the number of tracked background PIDs increases, the overhead of executing these checks within the precmd cycle can introduce perceptible latency to the shell prompt. There is a design tension between providing immediate feedback on process exit and maintaining the responsiveness of the Zsh Line Editor (ZLE).
- How can the frequency of background job status checks be limited to prevent prompt lag?
- Is there a documented mechanism within zsh to trigger a visual alert only upon the specific receipt of a SIGCHLD signal without blocking the main thread?