in GoogleTestAdapter/Core/Helpers/ProcessExecutor.cs [177:222]
private static PROCESS_INFORMATION CreateProcess(string command, string parameters, string workingDir,
IDictionary<string, string> envVars, string pathExtension,
SafePipeHandle outputPipeWritingEnd)
{
var startupinfoex = new STARTUPINFOEX
{
StartupInfo = new STARTUPINFO
{
hStdOutput = outputPipeWritingEnd,
hStdError = outputPipeWritingEnd,
dwFlags = STARTF_USESTDHANDLES,
cb = Marshal.SizeOf(typeof(STARTUPINFOEX)),
}
};
string commandLine = $"\"{command}\"";
if (!string.IsNullOrEmpty(parameters))
commandLine += $" {parameters}";
if (string.IsNullOrEmpty(workingDir))
workingDir = null;
PROCESS_INFORMATION processInfo;
// ReSharper disable ArgumentsStyleNamedExpression
// ReSharper disable ArgumentsStyleLiteral
// ReSharper disable ArgumentsStyleOther
if (!CreateProcess(
lpApplicationName: null,
lpCommandLine: commandLine,
lpProcessAttributes: null,
lpThreadAttributes: null,
bInheritHandles: true,
dwCreationFlags: CREATE_EXTENDED_STARTUPINFO_PRESENT | CREATE_SUSPENDED,
lpEnvironment: CreateEnvironment(pathExtension, envVars),
lpCurrentDirectory: workingDir,
lpStartupInfo: startupinfoex,
lpProcessInformation: out processInfo))
{
throw new Win32Exception(Marshal.GetLastWin32Error(),
$"Could not create process. Command: '{command}', parameters: '{parameters}', working dir: '{workingDir}'");
}
// ReSharper restore ArgumentsStyleNamedExpression
// ReSharper restore ArgumentsStyleLiteral
// ReSharper restore ArgumentsStyleOther
return processInfo;
}