From 5c00b7d859d9c41e0a6e30b5a555d0a514c3213f Mon Sep 17 00:00:00 2001 From: Tor Colvin Date: Thu, 15 Aug 2024 10:23:56 -0400 Subject: [PATCH] windows requires no slashes in path names --- base/logging_test.go | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/base/logging_test.go b/base/logging_test.go index 876a8cec8a..8779abe425 100644 --- a/base/logging_test.go +++ b/base/logging_test.go @@ -13,6 +13,7 @@ import ( "fmt" "os" "path/filepath" + "regexp" "runtime" "testing" "time" @@ -325,7 +326,10 @@ func lumberjackTempDir(t *testing.T) string { } // On Windows, cleanup of t.TempDir() fails due to open log file handle from Lumberjack. Cannot be fixed from SG. // https://github.com/natefinch/lumberjack/issues/185 - logPath, err := os.MkdirTemp("", t.Name()) + + // windows requires no slashes in the path name + pathRegex := regexp.MustCompile(`/|\\`) + logPath, err := os.MkdirTemp("", string(pathRegex.ReplaceAll([]byte(t.Name()), []byte("_")))) require.NoError(t, err) t.Cleanup(func() { if err := os.RemoveAll(logPath); err != nil {