Keep stdout for test execution

Work around https://github.com/Microsoft/vstest/issues/1503 by using the
MSBuild escape hatch variable MSBUILDENSURESTDOUTFORTASKPROCESSES and
ensuring that tests don't run in a disconnected MSBuild process by
passing /nr:false.
This commit is contained in:
Rainer Sigwald 2018-03-24 11:59:36 -05:00
parent 5e6765093a
commit 29ac66f7d2

View file

@ -32,6 +32,7 @@ namespace Microsoft.DotNet.Tools.Test
{
"/t:VSTest",
"/v:quiet",
"/nodereuse:false", // workaround for https://github.com/Microsoft/vstest/issues/1503
"/nologo"
};
@ -95,7 +96,23 @@ namespace Microsoft.DotNet.Tools.Test
return e.ExitCode;
}
return cmd.Execute();
// Workaround for https://github.com/Microsoft/vstest/issues/1503
const string NodeWindowEnvironmentName = "MSBUILDENSURESTDOUTFORTASKPROCESSES";
string previousNodeWindowSetting = Environment.GetEnvironmentVariable(NodeWindowEnvironmentName);
int result = -1;
try
{
Environment.SetEnvironmentVariable(NodeWindowEnvironmentName, "1");
result = cmd.Execute();
}
finally
{
Environment.SetEnvironmentVariable(NodeWindowEnvironmentName, previousNodeWindowSetting);
}
return result;
}
private static string GetSemiColonEscapedString(string arg)