Skip to content

Commit

Permalink
Configure awaits in "RedistributableLocator" (#345)
Browse files Browse the repository at this point in the history
atifaziz authored Jan 27, 2025
1 parent 67a11a1 commit 8dfadcd
Showing 1 changed file with 11 additions and 6 deletions.
17 changes: 11 additions & 6 deletions src/CSnakes.Runtime/Locators/RedistributableLocator.cs
Original file line number Diff line number Diff line change
@@ -163,13 +163,18 @@ protected override string GetLibPythonPath(string folder, bool freeThreaded = fa
private static async Task<string> DownloadFileToTempDirectoryAsync(string fileUrl)
{
using HttpClient client = new();
using var contentStream = await client.GetStreamAsync(fileUrl);

string tempFilePath = Path.GetTempFileName();
using FileStream fileStream = new FileStream(tempFilePath, FileMode.Create, FileAccess.Write, FileShare.None);
await contentStream.CopyToAsync(fileStream);
var contentStream = await client.GetStreamAsync(fileUrl).ConfigureAwait(false);
await using (contentStream.ConfigureAwait(false))
{
string tempFilePath = Path.GetTempFileName();
var fileStream = new FileStream(tempFilePath, FileMode.Create, FileAccess.Write, FileShare.None);
await using (fileStream.ConfigureAwait(false))
{
await contentStream.CopyToAsync(fileStream).ConfigureAwait(false);
}

return tempFilePath;
return tempFilePath;
}
}

private static string DecompressZstFile(string zstFilePath)

0 comments on commit 8dfadcd

Please sign in to comment.