in GoogleTestAdapter/Core/Helpers/ProcessLauncher.cs [51:103]
private int LaunchProcess(string workingDirectory, IDictionary<string, string> additionalEnvVars, string command, string param, bool printTestOutput,
bool throwIfError, List<string> output)
{
var processStartInfo = new ProcessStartInfo(command, param)
{
StandardOutputEncoding = Encoding.Default,
RedirectStandardOutput = true,
RedirectStandardError = false,
UseShellExecute = false,
CreateNoWindow = true,
WorkingDirectory = workingDirectory
};
if (additionalEnvVars != null)
{
foreach (var entry in additionalEnvVars)
{
processStartInfo.EnvironmentVariables[entry.Key] = entry.Value;
}
}
if (!string.IsNullOrEmpty(_pathExtension))
{
var path = Utils.GetExtendedPath(_pathExtension);
if (processStartInfo.EnvironmentVariables.ContainsKey("PATH"))
{
path += $";{processStartInfo.EnvironmentVariables["PATH"]}";
}
processStartInfo.EnvironmentVariables["PATH"] = path;
}
Process process = Process.Start(processStartInfo);
if (process != null)
_reportProcessId?.Invoke(process.Id);
try
{
var waiter = new ProcessWaiter(process);
if (printTestOutput)
{
_logger.LogInfo(String.Format(Resources.OutputOfCommandMessage, "", command, param));
}
ReadTheStream(process, output, printTestOutput, throwIfError);
if (printTestOutput)
{
_logger.LogInfo(String.Format(Resources.EndOfOutputMessage, ""));
}
return waiter.WaitForExit();
}
finally
{
process?.Dispose();
}
}