Skip to content

Commit 77b45bd

Browse files
authored
Merge pull request microsoft#182781 from microsoft/tyriar/delimiter
Support : in values for VSCODE_ENV_* variables
2 parents 0f833f2 + a240090 commit 77b45bd

File tree

4 files changed

+12
-15
lines changed

4 files changed

+12
-15
lines changed

src/vs/workbench/contrib/terminal/browser/media/shellIntegration-bash.sh

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ if [ -n "$VSCODE_ENV_REPLACE" ]; then
5050
IFS=':' read -ra ADDR <<< "$VSCODE_ENV_REPLACE"
5151
for ITEM in "${ADDR[@]}"; do
5252
VARNAME="$(echo $ITEM | cut -d "=" -f 1)"
53-
VALUE="$(echo $ITEM | cut -d "=" -f 2)"
53+
VALUE="$(echo -e "$ITEM" | cut -d "=" -f 2)"
5454
export $VARNAME="$VALUE"
5555
done
5656
builtin unset VSCODE_ENV_REPLACE
@@ -59,7 +59,7 @@ if [ -n "$VSCODE_ENV_PREPEND" ]; then
5959
IFS=':' read -ra ADDR <<< "$VSCODE_ENV_PREPEND"
6060
for ITEM in "${ADDR[@]}"; do
6161
VARNAME="$(echo $ITEM | cut -d "=" -f 1)"
62-
VALUE="$(echo $ITEM | cut -d "=" -f 2)"
62+
VALUE="$(echo -e "$ITEM" | cut -d "=" -f 2)"
6363
export $VARNAME="$VALUE${!VARNAME}"
6464
done
6565
builtin unset VSCODE_ENV_PREPEND
@@ -68,7 +68,7 @@ if [ -n "$VSCODE_ENV_APPEND" ]; then
6868
IFS=':' read -ra ADDR <<< "$VSCODE_ENV_APPEND"
6969
for ITEM in "${ADDR[@]}"; do
7070
VARNAME="$(echo $ITEM | cut -d "=" -f 1)"
71-
VALUE="$(echo $ITEM | cut -d "=" -f 2)"
71+
VALUE="$(echo -e "$ITEM" | cut -d "=" -f 2)"
7272
export $VARNAME="${!VARNAME}$VALUE"
7373
done
7474
builtin unset VSCODE_ENV_APPEND

src/vs/workbench/contrib/terminal/browser/media/shellIntegration-rc.zsh

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -40,29 +40,26 @@ fi
4040

4141
# Apply EnvironmentVariableCollections if needed
4242
if [ -n "$VSCODE_ENV_REPLACE" ]; then
43-
echo "VSCODE_ENV_REPLACE: $VSCODE_ENV_REPLACE"
4443
IFS=':' read -rA ADDR <<< "$VSCODE_ENV_REPLACE"
4544
for ITEM in "${ADDR[@]}"; do
4645
VARNAME="$(echo ${ITEM%%=*})"
47-
export $VARNAME="${ITEM#*=}"
46+
export $VARNAME="$(echo -e ${ITEM#*=})"
4847
done
4948
unset VSCODE_ENV_REPLACE
5049
fi
5150
if [ -n "$VSCODE_ENV_PREPEND" ]; then
52-
echo "VSCODE_ENV_PREPEND: $VSCODE_ENV_PREPEND"
5351
IFS=':' read -rA ADDR <<< "$VSCODE_ENV_PREPEND"
5452
for ITEM in "${ADDR[@]}"; do
5553
VARNAME="$(echo ${ITEM%%=*})"
56-
export $VARNAME="${ITEM#*=}${(P)VARNAME}"
54+
export $VARNAME="$(echo -e {ITEM#*=})${(P)VARNAME}"
5755
done
5856
unset VSCODE_ENV_PREPEND
5957
fi
6058
if [ -n "$VSCODE_ENV_APPEND" ]; then
61-
echo "VSCODE_ENV_APPEND: $VSCODE_ENV_APPEND"
6259
IFS=':' read -rA ADDR <<< "$VSCODE_ENV_APPEND"
6360
for ITEM in "${ADDR[@]}"; do
6461
VARNAME="$(echo ${ITEM%%=*})"
65-
export $VARNAME="${(P)VARNAME}${ITEM#*=}"
62+
export $VARNAME="${(P)VARNAME}$(echo -e {ITEM#*=})"
6663
done
6764
unset VSCODE_ENV_APPEND
6865
fi

src/vs/workbench/contrib/terminal/browser/media/shellIntegration.fish

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -33,23 +33,23 @@ if test -n "$VSCODE_ENV_REPLACE"
3333
set ITEMS (string split : $VSCODE_ENV_REPLACE)
3434
for B in $ITEMS
3535
set split (string split = $B)
36-
set -gx "$split[1]" "$split[2]"
36+
set -gx "$split[1]" (echo -e "$split[2]")
3737
end
3838
set -e VSCODE_ENV_REPLACE
3939
end
4040
if test -n "$VSCODE_ENV_PREPEND"
4141
set ITEMS (string split : $VSCODE_ENV_PREPEND)
4242
for B in $ITEMS
4343
set split (string split = $B)
44-
set -gx "$split[1]" "$split[2]$$split[1]" # avoid -p as it adds a space
44+
set -gx "$split[1]" (echo -e "$split[2]")"$$split[1]" # avoid -p as it adds a space
4545
end
4646
set -e VSCODE_ENV_PREPEND
4747
end
4848
if test -n "$VSCODE_ENV_APPEND"
4949
set ITEMS (string split : $VSCODE_ENV_APPEND)
5050
for B in $ITEMS
5151
set split (string split = $B)
52-
set -gx "$split[1]" "$$split[1]$split[2]" # avoid -a as it adds a space
52+
set -gx "$split[1]" "$$split[1]"(echo -e "$split[2]") # avoid -a as it adds a space
5353
end
5454
set -e VSCODE_ENV_APPEND
5555
end

src/vs/workbench/contrib/terminal/browser/media/shellIntegration.ps1

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -25,23 +25,23 @@ if ($env:VSCODE_ENV_REPLACE) {
2525
$Split = $env:VSCODE_ENV_REPLACE.Split(":")
2626
foreach ($Item in $Split) {
2727
$Inner = $Item.Split('=')
28-
[Environment]::SetEnvironmentVariable($Inner[0], $Inner[1])
28+
[Environment]::SetEnvironmentVariable($Inner[0], $Inner[1].Replace('\x3a', ':'))
2929
}
3030
$env:VSCODE_ENV_REPLACE = $null
3131
}
3232
if ($env:VSCODE_ENV_PREPEND) {
3333
$Split = $env:VSCODE_ENV_PREPEND.Split(":")
3434
foreach ($Item in $Split) {
3535
$Inner = $Item.Split('=')
36-
[Environment]::SetEnvironmentVariable($Inner[0], $Inner[1] + [Environment]::GetEnvironmentVariable($Inner[0]))
36+
[Environment]::SetEnvironmentVariable($Inner[0], $Inner[1].Replace('\x3a', ':') + [Environment]::GetEnvironmentVariable($Inner[0]))
3737
}
3838
$env:VSCODE_ENV_PREPEND = $null
3939
}
4040
if ($env:VSCODE_ENV_APPEND) {
4141
$Split = $env:VSCODE_ENV_APPEND.Split(":")
4242
foreach ($Item in $Split) {
4343
$Inner = $Item.Split('=')
44-
[Environment]::SetEnvironmentVariable($Inner[0], [Environment]::GetEnvironmentVariable($Inner[0]) + $Inner[1])
44+
[Environment]::SetEnvironmentVariable($Inner[0], [Environment]::GetEnvironmentVariable($Inner[0]) + $Inner[1].Replace('\x3a', ':'))
4545
}
4646
$env:VSCODE_ENV_APPEND = $null
4747
}

0 commit comments

Comments
 (0)