Skip to content

Commit

Permalink
Keep stdout for test execution
Browse files Browse the repository at this point in the history
Work around microsoft/vstest#1503 by using the
MSBuild escape hatch variable MSBUILDNODEWINDOW and ensuring that
tests don't run in a disconnected MSBuild process by passing /nr:false.
  • Loading branch information
rainersigwald committed Mar 24, 2018
1 parent 46b7dee commit c6d5dfa
Showing 1 changed file with 17 additions and 1 deletion.
18 changes: 17 additions & 1 deletion src/dotnet/commands/dotnet-test/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ public static TestCommand FromArgs(string[] args, string msbuildPath = null)
{
"/t:VSTest",
"/v:quiet",
"/nodereuse:false", // workaround for https://github.com/Microsoft/vstest/issues/1503
"/nologo"
};

Expand Down Expand Up @@ -95,7 +96,22 @@ public static int Run(string[] args)
return e.ExitCode;
}

return cmd.Execute();
// Workaround for https://github.com/Microsoft/vstest/issues/1503
const string NodeWindowEnvironmentName = "MSBUILDNODEWINDOW";
string previousNodeWindowSetting = Environment.GetEnvironmentVariable(NodeWindowEnvironmentName);

int result = -1;

try
{
result = cmd.Execute();
}
finally
{
Environment.SetEnvironmentVariable(NodeWindowEnvironmentName, previousNodeWindowSetting);
}

return result;
}

private static string GetSemiColonEscapedString(string arg)
Expand Down

0 comments on commit c6d5dfa

Please sign in to comment.