Skip to content

Instantly share code, notes, and snippets.

@scottopell
Last active November 27, 2023 12:50
Show Gist options
  • Save scottopell/6478fe7615799c35d43e242c2d2e6465 to your computer and use it in GitHub Desktop.
Save scottopell/6478fe7615799c35d43e242c2d2e6465 to your computer and use it in GitHub Desktop.
zpty

zpty

Zsh has a feature called zpty which creates a pseudo-terminal in the background.

According to the docs, this can be useful to run a program in the background that expects to be run in a normal terminal environment.

Some zsh themes such as pure use this to run commands asynchronously. Pure uses the zsh plugin zsh-async for this.

zsh-async provides a very nice wrapper, but I wanted to play around a bit and make sure I understood the basics.

https://asciinema.org/a/TdWmfaUO75FDuvGuniAJHuRKk?speed=3

I have no idea where testing1 went.

update I compiled zsh from scratch with the intention of figuring out where testing1 went. But I see different behavior on my fresh build.

https://asciinema.org/a/9sQSe5ZyzGnpNnyBS4ZnA2TQx?speed=3

Could be a difference in versions? Or (more likely) something in my zsh environment is messing with what I'm seeing.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment