Skip to content

fix(scm-prompt): suppress cd output#985

Closed
vegerot wants to merge 1 commit intofacebook:mainfrom
vegerot:pr985
Closed

fix(scm-prompt): suppress cd output#985
vegerot wants to merge 1 commit intofacebook:mainfrom
vegerot:pr985

Conversation

@vegerot
Copy link
Contributor

@vegerot vegerot commented Nov 22, 2024

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 --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
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.

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.
@facebook-github-bot
Copy link
Contributor

@facebook-github-bot has imported this pull request. If you are a Meta employee, you can view this diff on Phabricator.

@facebook-github-bot
Copy link
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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants