From e5aaab5a0204218550b8a72994a2c317034394d5 Mon Sep 17 00:00:00 2001 From: Scott Hutchinson Date: Sun, 17 Jan 2021 11:44:43 -0800 Subject: [PATCH 1/2] Prevent tests from attempting to write to C:\Windows\System32 Fixes Issue #10887. --- tests/FSharp.Test.Utilities/TestFramework.fs | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/tests/FSharp.Test.Utilities/TestFramework.fs b/tests/FSharp.Test.Utilities/TestFramework.fs index a27a140c98..1ab95c5576 100644 --- a/tests/FSharp.Test.Utilities/TestFramework.fs +++ b/tests/FSharp.Test.Utilities/TestFramework.fs @@ -55,8 +55,17 @@ module Commands = else p.WaitForExit() #if DEBUG - File.WriteAllLines(Path.Combine(workingDir, "StandardOutput.txt"), outputList) - File.WriteAllLines(Path.Combine(workingDir, "StandardError.txt"), errorsList) + let workingDir' = + if workingDir = "" + then + // Assign working dir to prevent default to C:\Windows\System32 + let executionLocation = Assembly.GetExecutingAssembly().Location + Path.GetDirectoryName executionLocation + else + workingDir + + File.WriteAllLines(Path.Combine(workingDir', "StandardOutput.txt"), outputList) + File.WriteAllLines(Path.Combine(workingDir', "StandardError.txt"), errorsList) #endif p.ExitCode, outputList.ToArray(), errorsList.ToArray() | None -> -1, Array.empty, Array.empty From 110ed5f6fc9348417e02fff4e59da334fcf835f8 Mon Sep 17 00:00:00 2001 From: Scott Hutchinson Date: Mon, 18 Jan 2021 10:58:47 -0800 Subject: [PATCH 2/2] Add open System.Reflection --- tests/FSharp.Test.Utilities/TestFramework.fs | 1 + 1 file changed, 1 insertion(+) diff --git a/tests/FSharp.Test.Utilities/TestFramework.fs b/tests/FSharp.Test.Utilities/TestFramework.fs index 1ab95c5576..012ca3b895 100644 --- a/tests/FSharp.Test.Utilities/TestFramework.fs +++ b/tests/FSharp.Test.Utilities/TestFramework.fs @@ -5,6 +5,7 @@ module TestFramework open Microsoft.Win32 open System open System.IO +open System.Reflection open System.Text.RegularExpressions open System.Diagnostics open Scripting