Commit a217468
fix(scm-prompt): suppress cd output (#985)
Summary:
If a user has a `chpwd` hook that prints output, it will be prepended to the
`dir` variable which breaks the prompt. This change suppresses the output of
`cd` to prevent this.
Alternatively I considered doing `cd -q` to skip running the chpwd hook, but
decided against it.
Pull Request resolved: #985
Test Plan:
```zsh
$ zsh --no-rcs
$ source ~/workspace/github.com/facebook/sapling/eden/scm/contrib/scm-prompt.sh && _scm_prompt
# things should be fine
$ say_hi() { echo hello } && chpwd_functions+=(say_hi) && _scm_prompt
```
prior to this commit, the prompt would be broken. After this commit, it should
be fine.
Background: in my particular case, I have a `chpwd` hook that
[sources custom scripts](https://github.com/vegerot/dotfiles/blob/032f88715fa2911bec6b3c09aa012145bb1dae7e/.zshrc#L250-L252)
depending on the directory, and will tell me if it does so. This was breaking
the prompt, so I added this change to fix it.
Reviewed By: quark-zju
Differential Revision: D66384725
fbshipit-source-id: e03d18887a27fc6c55da1dc7347eacf0fa38cde71 parent 0611423 commit a217468
1 file changed
Lines changed: 1 addition & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
257 | 257 | | |
258 | 258 | | |
259 | 259 | | |
260 | | - | |
| 260 | + | |
261 | 261 | | |
262 | 262 | | |
263 | 263 | | |
| |||
0 commit comments