Skip to content

Conversation

@anthonykim1
Copy link

@anthonykim1 anthonykim1 commented Feb 19, 2025

Gitbash repro steps:

  • Opt into Terminal Env Var experiment
  • Make sure shell integration setting is on (generic terminal one)
  • Be on Windows gitbash (with activated environment)
  • You will see messed up prompt cwd

Resolves: #23382

@anthonykim1 anthonykim1 added the skip tests Updates to tests unnecessary label Feb 19, 2025
@anthonykim1 anthonykim1 self-assigned this Feb 19, 2025
@anthonykim1
Copy link
Author

anthonykim1 commented Feb 19, 2025

Always turning off applyAtShellIntegration option seem to resolve the issue. (So only applying things ONLY at the process creation resolves the issue, whereas before sometimes both were enabled as true which seemed to lead to repro of the behavior)

                        const options = {
                            applyAtShellIntegration: false,
                            applyAtProcessCreation: true,
                        };

but this is concerning, given that we had to switch to this "double prepend" for some reasons in the past.

Reference: #22905 (double prepend) instead of #21906 (for prepending)

Potential cause:

  1. It could be a problem with applyAtShellIntegration itself
  2. It could be problem with the fact that we are applying at BOTH applyAtShellIntegration AND applyAtProcessCreation.
  3. VSCODE_CWD and PWD is wrongly set from core, and in the process of implicitly activate user's environment (via terminal env var experiment setting each individual user's environment variable, we wrongly cache and set this not-intended to be saved/cached VSCODE_CWD and PWD Screenshot 2025-02-19 at 1 36 15 PM
    and
    Screenshot 2025-02-18 at 4 16 08 PM

Fix: Avoid setting PWD when in Terminal Env Var experiment.

@anthonykim1 anthonykim1 force-pushed the anthonykim/InvestigateGitBash branch from bfe89b8 to 42962ce Compare February 20, 2025 21:24
@anthonykim1 anthonykim1 reopened this Feb 20, 2025
@anthonykim1 anthonykim1 added bug Issue identified by VS Code Team member as probable bug area-terminal labels Feb 20, 2025
@anthonykim1 anthonykim1 changed the title Debug gitbash problem Prevent Python extension overriding Gitbash pwd Feb 20, 2025
@anthonykim1 anthonykim1 changed the title Prevent Python extension overriding Gitbash pwd Prevent python extension from overriding gitbash pwd Feb 20, 2025
@anthonykim1 anthonykim1 marked this pull request as ready for review February 20, 2025 22:30
@anthonykim1 anthonykim1 added this to the February 2025 milestone Feb 20, 2025
@vs-code-engineering
Copy link

⚠️ This PR originates from a fork. Due to security restrictions, pipelines from forks are no longer triggered automatically. Learn more.

If the changes appear safe, you can manually trigger the pipeline by commenting /AzurePipelines run.

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

Labels

area-terminal bug Issue identified by VS Code Team member as probable bug skip tests Updates to tests unnecessary skip-issue-check

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Gitbash terminal not opening to workspace folder.

2 participants