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)