Skip to content

Commit 93073fa

Browse files
committed
resilent removing of mencoder bin
1 parent fa53a1a commit 93073fa

File tree

1 file changed

+17
-1
lines changed

1 file changed

+17
-1
lines changed

MencoderSharp/MencoderBase.cs

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -126,7 +126,23 @@ protected virtual void Dispose(bool disposing)
126126
Task.Delay(5).Wait();
127127
}
128128
}
129-
File.Delete(PathToExternalMencoderBin);
129+
while (File.Exists(PathToExternalMencoderBin))
130+
{
131+
var timeout = 0;
132+
try
133+
{
134+
File.Delete(PathToExternalMencoderBin);
135+
}
136+
catch (UnauthorizedAccessException)
137+
{
138+
if (timeout > 100)
139+
{
140+
throw;
141+
}
142+
timeout++;
143+
Task.Delay(5).Wait();
144+
}
145+
}
130146
}
131147

132148
disposedValue = true;

0 commit comments

Comments
 (0)