Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support : in values for VSCODE_ENV_* variables #182781

Merged
merged 3 commits into from
May 17, 2023
Merged

Support : in values for VSCODE_ENV_* variables #182781

merged 3 commits into from
May 17, 2023

Conversation

Tyriar
Copy link
Member

@Tyriar Tyriar commented May 17, 2023

Fixes #181934
Part of #179476

cc @karrtikr

@Tyriar Tyriar added this to the May 2023 milestone May 17, 2023
@Tyriar Tyriar self-assigned this May 17, 2023
@@ -25,23 +25,23 @@ if ($env:VSCODE_ENV_REPLACE) {
$Split = $env:VSCODE_ENV_REPLACE.Split(":")
foreach ($Item in $Split) {
$Inner = $Item.Split('=')
[Environment]::SetEnvironmentVariable($Inner[0], $Inner[1])
[Environment]::SetEnvironmentVariable($Inner[0], $Inner[1].Replace('\x3a', ':'))
Copy link
Contributor

Choose a reason for hiding this comment

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

Can you clarify what this does?

Copy link
Member Author

Choose a reason for hiding this comment

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

When vscode sets the variable it will ensure all values have : encoded as \x3a', so to test this out you'll want to encode the values like this:

VAR1=VAL1:VAR2=http\x3a//github.com

Copy link
Member Author

Choose a reason for hiding this comment

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

We do it this way because we can't pass \0 into environment variables and splitting multi-character strings is tricky in some shells.

@Tyriar Tyriar merged commit 77b45bd into main May 17, 2023
@Tyriar Tyriar deleted the tyriar/delimiter branch May 17, 2023 17:11
@github-actions github-actions bot locked and limited conversation to collaborators Jul 1, 2023
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.

VSCODE_ENV_* variables to adjust environment in shell integration script do not work
2 participants