8000 Fixed issue #970 · libgit2/libgit2sharp@2429805 · GitHub
[go: up one dir, main page]

Skip to content

Commit 2429805

Browse files
Fixed issue #970
1 parent 605b623 commit 2429805

File tree

1 file changed

+13
-1
lines changed

1 file changed

+13
-1
lines changed

LibGit2Sharp.Tests/TestHelpers/DirectoryHelper.cs

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,19 @@ public static void DeleteDirectory(string directoryPath)
6060
foreach (string file in files)
6161
{
6262
File.SetAttributes(file, FileAttributes.Normal);
63-
File.Delete(file);
63+
try
64+
{
65+
File.Delete(file);
66+
}
67+
catch (Exception)
68+
{
69+
Trace.WriteLine(string.Format("{0}The file '{1}' could not be deleted!" +
70+
"{0}Most of the time, this is due to an external process accessing the files in the temporary repositories created during the test runs, and keeping a handle on the directory, thus preventing the deletion of those files." +
71+
"{0}Known and common causes include:" +
72+
"{0}- Windows Search Indexer (go to the Indexing Options, in the Windows Control Panel, and exclude the bin folder of LibGit2Sharp.Tests)" +
73+
"{0}- Antivirus (exclude the bin folder of LibGit2Sharp.Tests from the paths scanned by your real-time antivirus){0}",
74+
Environment.NewLine, Path.GetFullPath(file)));
75+
}
6476
}
6577

6678
foreach (string dir in dirs)

0 commit comments

Comments
 (0)
0