Skip to content

Commit e607bdf

Browse files
authored
Forward env variables in test debugging (#1951)
Issue #1946 Node will override all env variables if you pass an env argument. So we need to modify the parent process env
1 parent 3e043e2 commit e607bdf

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

src/Components/TestExplorer.fs

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -566,7 +566,12 @@ module DotnetCli =
566566
launchDebugger processId
567567
isDebuggerStarted <- true
568568

569-
let env = {| VSTEST_HOST_DEBUG = 1 |} |> box |> Some
569+
let env =
570+
let parentEnv = Node.Api.``process``.env
571+
let childEnv = parentEnv
572+
childEnv?VSTEST_HOST_DEBUG <- 1
573+
childEnv |> box |> Some
574+
570575
Process.execWithCancel "dotnet" (ResizeArray(args)) env tryLaunchDebugger cancellationToken
571576
| NoDebug -> Process.execWithCancel "dotnet" (ResizeArray(args)) None ignore cancellationToken
572577

0 commit comments

Comments
 (0)