Skip to content

Conversation

@mawosoft
Copy link
Contributor

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

See #248625 for previous fix.

Check if variable exists before accessing it to prevent script failures in strict mode.
See microsoft#248625 for previous fix.
Tyriar
Tyriar previously approved these changes Sep 12, 2025
Copy link
Member

@Tyriar Tyriar left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Member

@Tyriar Tyriar left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@mawosoft can you comment on #255699 which was fixed via d62248e? I'm not familiar with that syntax in pwsh and don't want this pretty bad issue to come back.

@mawosoft
Copy link
Contributor Author

@Tyriar
The Test-Path command that was removed in d62248e incorrectly checks for the existence of a variable member. That is not possible. You can only use Test-Path to check for the variable itself.

Copy link
Member

@Tyriar Tyriar left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Makes sense, thanks!

@Tyriar Tyriar enabled auto-merge September 12, 2025 11:53
@vs-code-engineering vs-code-engineering bot added this to the September 2025 milestone Sep 12, 2025
@Tyriar Tyriar merged commit fc26325 into microsoft:main Sep 12, 2025
17 checks passed
@codykonior
Copy link

Thanks for this, the error message on every terminal open was driving me crazy.

@vs-code-engineering vs-code-engineering bot locked and limited conversation to collaborators Oct 27, 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