Closed
Conversation
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.
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.
Contributor
|
@facebook-github-bot has imported this pull request. If you are a Meta employee, you can view this diff on Phabricator. |
Contributor
|
This pull request has been merged in a217468. |
facebook-github-bot
pushed a commit
that referenced
this pull request
Jul 10, 2025
Summary: @public 1.0.2 comes with a vulnerable idna. v2.5.4 Latest Revert "Normalize URL paths: convert /.//p, /..//p, and //p to p (#943)" by valenting in #999 Updates the MSRV to 1.63 required though the libc v0.2.164 dependency v2.5.3 fix: enable wasip2 feature for wasm32-wasip2 target by brooksmtownsend in #960 Fix idna tests with no_std by cjwatson in #963 Fix debugger_visualizer test failures. by valenting in #967 Add AsciiSet::EMPTY and boolean operators by joshka in #969 mention why we pin unicode-width by Manishearth in #972 refactor and add tests for percent encoding by joshka in #977 Add a test for and fix issue #974 by hansl in #975 no_std support for the url crate by domenukk in #831 Normalize URL paths: convert /.//p, /..//p, and //p to p by theskim in #943 support Hermit by m-mueller678 in #985 fix: support wasm32-wasip2 on the stable channel by brooksmtownsend in #983 Improve serde error output by konstin in #982 OSS-Fuzz: Add more fuzzer by arthurscchan in #988 Merge idna-v1x to main by hsivonen in #990 What's Changed fix: enable wasip2 feature for wasm32-wasip2 target by brooksmtownsend in #960 Fix idna tests with no_std by cjwatson in #963 Fix debugger_visualizer test failures. by valenting in #967 Add AsciiSet::EMPTY and boolean operators by joshka in #969 mention why we pin unicode-width by Manishearth in #972 refactor and add tests for percent encoding by joshka in #977 Add a test for and fix issue #974 by hansl in #975 no_std support for the url crate by domenukk in #831 Normalize URL paths: convert /.//p, /..//p, and //p to p by theskim in #943 support Hermit by m-mueller678 in #985 fix: support wasm32-wasip2 on the stable channel by brooksmtownsend in #983 Improve serde error output by konstin in #982 OSS-Fuzz: Add more fuzzer by arthurscchan in #988 Merge idna-v1x to main by hsivonen in #990 Reviewed By: dtolnay Differential Revision: D78043174 fbshipit-source-id: 93ca32d2a17f6cf3662055050ef77b1906edcdae
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary:
If a user has a
chpwdhook that prints output, it will be prepended to thedirvariable which breaks the prompt. This change suppresses the output ofcdto prevent this.Alternatively I considered doing
cd -qto skip running the chpwd hook, butdecided against it.
Test Plan:
prior to this commit, the prompt would be broken. After this commit, it should
be fine.
Background: in my particular case, I have a
chpwdhook thatsources custom scripts
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.