Browse Source

avoid exceptions in PrepareRemoteExecutor()

af/octree-no-pixelmap
Anton Firszov 6 years ago
parent
commit
10b3921ec1
  1. 31
      tests/ImageSharp.Tests/TestUtilities/TestEnvironment.cs

31
tests/ImageSharp.Tests/TestUtilities/TestEnvironment.cs

@ -165,26 +165,27 @@ namespace SixLabors.ImageSharp.Tests
return; return;
} }
string windowsSdksDir = Path.Combine(Environment.GetEnvironmentVariable("PROGRAMFILES(x86)"), // Locate and run CorFlags.exe:
"Microsoft SDKs", "Windows"); try
{
string windowsSdksDir = Path.Combine(Environment.GetEnvironmentVariable("PROGRAMFILES(x86)"),
"Microsoft SDKs", "Windows");
FileInfo corFlagsFile = Find(new DirectoryInfo(windowsSdksDir), "corflags.exe"); FileInfo corFlagsFile = Find(new DirectoryInfo(windowsSdksDir), "corflags.exe");
string remoteExecutorPath = Path.Combine(assemblyFile.DirectoryName, "Microsoft.DotNet.RemoteExecutor.exe"); string remoteExecutorPath = Path.Combine(assemblyFile.DirectoryName, "Microsoft.DotNet.RemoteExecutor.exe");
string args = $"{remoteExecutorPath} /32Bit+ /Force"; string args = $"{remoteExecutorPath} /32Bit+ /Force";
var si = new ProcessStartInfo() var si = new ProcessStartInfo()
{ {
FileName = corFlagsFile.FullName, FileName = corFlagsFile.FullName,
Arguments = args, Arguments = args,
UseShellExecute = false, UseShellExecute = false,
RedirectStandardOutput = true, RedirectStandardOutput = true,
RedirectStandardError = true RedirectStandardError = true
}; };
try
{
using var proc = Process.Start(si); using var proc = Process.Start(si);
proc.WaitForExit(); proc.WaitForExit();
string standardOutput = proc.StandardOutput.ReadToEnd(); string standardOutput = proc.StandardOutput.ReadToEnd();

Loading…
Cancel
Save