Don't display any GUI during test run. (dotnet/corefx#38042)
authorjoshudson <joshudson@gmail.com>
Tue, 1 Oct 2019 22:53:50 +0000 (15:53 -0700)
committerSantiago Fernandez Madero <safern@microsoft.com>
Tue, 1 Oct 2019 22:53:50 +0000 (15:53 -0700)
Commit migrated from https://github.com/dotnet/corefx/commit/6c892a14e4da5e1ec0c5c766c7625c4d2d51ffb6

src/libraries/System.Diagnostics.Process/tests/ProcessTests.Unix.cs

index 2b1529e..084501e 100644 (file)
@@ -229,7 +229,9 @@ namespace System.Diagnostics.Tests
             }
 
             // Open a file that doesn't exist with an argument that xdg-open considers invalid.
-            using (var px = Process.Start(new ProcessStartInfo { UseShellExecute = true, FileName = "/nosuchfile", Arguments = "invalid_arg" }))
+            var startInfo = new ProcessStartInfo { UseShellExecute = true, FileName = "/nosuchfile", Arguments = "invalid_arg" };
+            startInfo.Environment.Remove("DISPLAY"); // Get rid of DISPLAY environment variable as this causes spurious test failures.
+            using (var px = Process.Start(startInfo))
             {
                 Assert.NotNull(px);
                 px.WaitForExit();