From 1367a3f0d3b59bb0618e91d8767e9bbff985f786 Mon Sep 17 00:00:00 2001 From: Spencer Farley <2847259+farlee2121@users.noreply.github.com> Date: Sun, 8 Oct 2023 15:27:26 -0500 Subject: [PATCH] Forward env variables in test debugging Issue #1946 Node will override all env variables if you pass an env argument. So we need to modify the parent process env --- src/Components/TestExplorer.fs | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/Components/TestExplorer.fs b/src/Components/TestExplorer.fs index 51d5594d..a5d3305f 100644 --- a/src/Components/TestExplorer.fs +++ b/src/Components/TestExplorer.fs @@ -566,7 +566,12 @@ module DotnetCli = launchDebugger processId isDebuggerStarted <- true - let env = {| VSTEST_HOST_DEBUG = 1 |} |> box |> Some + let env = + let parentEnv = Node.Api.``process``.env + let childEnv = parentEnv + childEnv?VSTEST_HOST_DEBUG <- 1 + childEnv |> box |> Some + Process.execWithCancel "dotnet" (ResizeArray(args)) env tryLaunchDebugger cancellationToken | NoDebug -> Process.execWithCancel "dotnet" (ResizeArray(args)) None ignore cancellationToken