From b2fe32901128e45c5fc9f365b150614deb2a8e7e Mon Sep 17 00:00:00 2001 From: cmbrose <5447118+cmbrose@users.noreply.github.com> Date: Wed, 29 Jun 2022 12:28:21 -0500 Subject: [PATCH] Close files to actually fix windows --- pkg/cmd/codespace/ssh_test.go | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/pkg/cmd/codespace/ssh_test.go b/pkg/cmd/codespace/ssh_test.go index adad394d3..8bc6c517f 100644 --- a/pkg/cmd/codespace/ssh_test.go +++ b/pkg/cmd/codespace/ssh_test.go @@ -71,12 +71,13 @@ func TestAutomaticSSHKeyPairs(t *testing.T) { ConfigDir: dir, } - defer os.RemoveAll(dir) - for _, file := range tt.existingFiles { - if _, err := os.Create(filepath.Join(dir, file)); err != nil { + f, err := os.Create(filepath.Join(dir, file)) + if err != nil { t.Errorf("Failed to setup test files: %v", err) } + // If the file isn't closed here windows will have errors about file already in use + f.Close() } keyPair, err := setupAutomaticSSHKeys(sshContext)