Skip to content

Commit 8b60fcb

Browse files
committed
Set working directory when deleting directory
This to try to avoid race conditions where the working directory would be deleted and cause Process.Start to throw.
1 parent 5d666ae commit 8b60fcb

File tree

1 file changed

+1
-0
lines changed

1 file changed

+1
-0
lines changed

src/NerdBank.GitVersioning.Tests/TestUtilities.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@ internal static void DeleteDirectory(string path)
3636
// Somehow making commits with libgit2sharp locks files
3737
// such that we can't delete them (but Windows Explorer can).
3838
var psi = new ProcessStartInfo("cmd.exe", $"/c rd /s /q \"{path}\"");
39+
psi.WorkingDirectory = Path.GetTempPath();
3940
psi.WindowStyle = ProcessWindowStyle.Hidden;
4041
var process = Process.Start(psi);
4142
process.WaitForExit();

0 commit comments

Comments
 (0)