zsh-async icon indicating copy to clipboard operation
zsh-async copied to clipboard

Consider moving away from zpty if possible

Open ericfreese opened this issue 7 years ago • 2 comments

I just came across a method for implementing async in zsh that doesn't require the zpty module. Take a look at this commit in zsh-autosuggestions: https://github.com/zsh-users/zsh-autosuggestions/pull/338

Not sure if it will work with zsh-async, but wanted to pass it along in case it might simplify things.

ericfreese avatar Jun 11 '18 08:06 ericfreese

Thanks for the suggestion! I have considered this method in the past, but the reasons for abandoning it escape me. (At least one reason is that I did not know about zle -F at the time.)

zsh-async does have some requirements that could be challenging using this approach:

  • Long running worker with multiple jobs/tasks running
    • (Reason for this is I've wanted to avoid the overhead of forking, the worker forks once and waits for jobs)
  • The worker needs to be able to terminate its jobs (this is done by sending a kill to the workers process group to ensure termination of all processes started by the jobs)
  • Not sure if a requirement, but at least it will not be possible to run applications (or run them in a mode) that expect the stdout to be connected to a terminal

IIRC there is also some difference in behavior between read and zpty -r (latter being more reliable) that might have affected this decision in the past. Although, this might not be relevant here.

Anywho, I'll take this up for consideration, and maybe experiment with it when I have some dead time 😄.

mafredri avatar Jun 14 '18 05:06 mafredri