-
-
Notifications
You must be signed in to change notification settings - Fork 25.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Output from chpwd hook contaminates script output #3524
Comments
Interestingly, I just saw today that the zsh FAQ suggests using the |
For future reference: I asked the zsh-workers list about this, and it turns out the FAQ example is fine: it's protected with a http://www.zsh.org/mla/workers/2015/msg00599.html This might be a better way of doing it than doing the update in |
Perfect, so that's going to be our solution. Love it that the answer was so succint and yet so obscure LOL. |
Yeah, I think so. I'll work on another patch for this, but am going to read up on the |
Well, looks like there's another problem with using More generally, not everything that changes the pwd of the foreground shell process is going to be caused by a It looks like Might still be worth adding the For future reference, another workaround might be redirecting the control characters to |
The recent change for Apple Terminal style pwd notification #3429 causes terminal control characters to be emitted upon each chpwd. This happens even if it's not about to display a prompt; e.g. if a cd is done inside a function or script.
This can contaminate the output of the function or script if it's being captured by anything. In particular, David Riley reports:
The recent change breaks Android development on OSX because Android
has a function:
The cd commands ends up printing some terminal commands which then get
returned from get_build_var which causes problems later on since it's
expecting a simple string instead of some terminal codes.
The pwd reporting mechanism needs to be changed to emit output only when it's safe to do so, i.e. when displaying an interactive prompt. (It might be convenient to do it on any cd change, so interactive scripts reflect their current location, but I don't think it can be done safely since the terminal control mechanism isn't out-of-band.)
This probably means moving the pwd reporting output back to a precmd hook.
The text was updated successfully, but these errors were encountered: