|
@@ -50,5 +50,39 @@ else
|
|
|
ARGS=("$@")
|
|
ARGS=("$@")
|
|
|
fi
|
|
fi
|
|
|
|
|
|
|
|
|
|
+# Ensure any VLS_* env vars are forwarded to the Windows process by listing
|
|
|
|
|
+# them in WSLENV.
|
|
|
|
|
+WSLENV_EXISTING="${WSLENV-}"
|
|
|
|
|
+WSLENV_ENTRIES=()
|
|
|
|
|
+if [[ -n "$WSLENV_EXISTING" ]]; then
|
|
|
|
|
+ IFS=':' read -r -a WSLENV_ENTRIES <<<"$WSLENV_EXISTING"
|
|
|
|
|
+fi
|
|
|
|
|
+
|
|
|
|
|
+# Build a list of VLS_* vars present in the environment.
|
|
|
|
|
+VLS_ENV_VARS=()
|
|
|
|
|
+while IFS='=' read -r name _; do
|
|
|
|
|
+ if [[ "$name" == VLS_* ]]; then
|
|
|
|
|
+ VLS_ENV_VARS+=("$name")
|
|
|
|
|
+ fi
|
|
|
|
|
+done < <(env)
|
|
|
|
|
+
|
|
|
|
|
+# Append any missing VLS_* names to WSLENV (keeping existing ordering intact).
|
|
|
|
|
+if (( ${#VLS_ENV_VARS[@]} > 0 )); then
|
|
|
|
|
+ for var_name in "${VLS_ENV_VARS[@]}"; do
|
|
|
|
|
+ already_present=0
|
|
|
|
|
+ for existing in "${WSLENV_ENTRIES[@]}"; do
|
|
|
|
|
+ if [[ "$existing" == "$var_name" ]]; then
|
|
|
|
|
+ already_present=1
|
|
|
|
|
+ break
|
|
|
|
|
+ fi
|
|
|
|
|
+ done
|
|
|
|
|
+ if (( already_present == 0 )); then
|
|
|
|
|
+ WSLENV_ENTRIES+=("$var_name")
|
|
|
|
|
+ fi
|
|
|
|
|
+ done
|
|
|
|
|
+ WSLENV="$(IFS=:; echo "${WSLENV_ENTRIES[*]}")"
|
|
|
|
|
+ export WSLENV
|
|
|
|
|
+fi
|
|
|
|
|
+
|
|
|
# -u = unbuffered for immediate streaming
|
|
# -u = unbuffered for immediate streaming
|
|
|
exec "$PY" -u "$SCRIPT_WIN" "${ARGS[@]}"
|
|
exec "$PY" -u "$SCRIPT_WIN" "${ARGS[@]}"
|