Skip to content

Conversation

@mawosoft
Copy link
Contributor

Check if variable exists before accessing it to prevent script failures in strict mode.

Check if variable exists before accessing it to prevent script failures in strict mode.
@meganrogge
Copy link
Contributor

Thanks for the PR.

I added Set-StrictMode -Version Latest to the top of my $PROFILE and don't see any errors / shell integration works with that.

What are you seeing that makes you think we need to change this?

@mawosoft
Copy link
Contributor Author

@meganrogge Maybe in your configuration the global variable GitPromptSettings is defined, in mine it is not, causing the script to fail silently. No idea where the variable definition is supposed to come from.

@meganrogge
Copy link
Contributor

Interesting, I don't have any special config. What version are you using?

@mawosoft
Copy link
Contributor Author

@meganrogge

Version: 1.100.0 (system setup)
Commit: 19e0f9e681ecb8e5c09d8784acaa601316ca4571
Date: 2025-05-07T12:48:53.763Z
Electron: 34.5.1
ElectronBuildId: 11369351
Chromium: 132.0.6834.210
Node.js: 20.19.0
V8: 13.2.152.41-electron.0
OS: Windows_NT x64 10.0.19045

I don't have any special config either.

Quick search for the variable name through the vscode repo shows no other occurrence than the test in the integration script. What's the value of the variable on your system?

@meganrogge
Copy link
Contributor

I meant your pwsh version

@meganrogge
Copy link
Contributor

Looks like the var has no value, but it's not causing issues - are you seeing an error or issue?

@mawosoft
Copy link
Contributor Author

7.4.7

@mawosoft
Copy link
Contributor Author

Yes, in the $error collection (exception due to undefined variable). And, of course, any integration code afterwards is not executed.

@mawosoft
Copy link
Contributor Author

@meganrogge The variable seems to be a posh-git thing. I don't have that installed.

@meganrogge meganrogge added this to the May 2025 milestone May 12, 2025
@meganrogge meganrogge enabled auto-merge (squash) May 12, 2025 15:18
@meganrogge meganrogge merged commit d34b681 into microsoft:main May 12, 2025
7 checks passed
@vs-code-engineering vs-code-engineering bot locked and limited conversation to collaborators Jun 26, 2025
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants