Fixing how we clean the file when it fails to download. We were doing it inside the using statement, so it still had a lock to the file and failed to delete it.
This commit is contained in:
parent
087852b1b8
commit
de0ca4823f
1 changed files with 7 additions and 7 deletions
|
@ -34,17 +34,17 @@ namespace Microsoft.DotNet.Cli.Build
|
||||||
{
|
{
|
||||||
var getTask = httpClient.GetStreamAsync(Uri);
|
var getTask = httpClient.GetStreamAsync(Uri);
|
||||||
|
|
||||||
using (var outStream = File.Create(DestinationPath))
|
try
|
||||||
{
|
{
|
||||||
try
|
using (var outStream = File.Create(DestinationPath))
|
||||||
{
|
{
|
||||||
getTask.Result.CopyTo(outStream);
|
getTask.Result.CopyTo(outStream);
|
||||||
}
|
}
|
||||||
catch (Exception)
|
}
|
||||||
{
|
catch (Exception)
|
||||||
File.Delete(DestinationPath);
|
{
|
||||||
throw;
|
File.Delete(DestinationPath);
|
||||||
}
|
throw;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue