Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[xaprepare] skip download progress for dotnet-install script #9053

Merged
merged 3 commits into from
Jun 25, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@ class DownloadStatus
const uint DefaultUpdateInterval = 1000;
readonly object updateLock = new object ();

public static readonly DownloadStatus Empty = new DownloadStatus (0, _ => { });

ConcurrentQueue<ulong> byteSnapshots;
Stopwatch watch;
Action<DownloadStatus> updater;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -78,23 +78,13 @@ async Task<bool> DownloadDotNetInstallScript (Context context, string dotnetScri

Log.StatusLine ("Downloading dotnet-install script...");

(bool success, ulong size, HttpStatusCode status) = await Utilities.GetDownloadSizeWithStatus (dotnetScriptUrl);
if (!success) {
if (status == HttpStatusCode.NotFound) {
Log.WarningLine ($"dotnet-install URL '{dotnetScriptUrl}' not found.");
} else {
Log.WarningLine ($"Failed to obtain dotnet-install script size from URL '{dotnetScriptUrl}'. HTTP status code: {status} ({(int) status})");
}

if (File.Exists (dotnetScriptPath)) {
Log.WarningLine ($"Using cached installation script found in '{dotnetScriptPath}'");
return true;
}
if (File.Exists (dotnetScriptPath)) {
Log.WarningLine ($"Using cached installation script found in '{dotnetScriptPath}'");
return true;
}

DownloadStatus downloadStatus = Utilities.SetupDownloadStatus (context, size, context.InteractiveSession);
Log.StatusLine ($" {context.Characters.Link} {dotnetScriptUrl}", ConsoleColor.White);
await Download (context, dotnetScriptUrl, tempDotnetScriptPath, "dotnet-install", Path.GetFileName (dotnetScriptUrl.LocalPath), downloadStatus);
await Utilities.Download (dotnetScriptUrl, tempDotnetScriptPath, DownloadStatus.Empty);

if (File.Exists (tempDotnetScriptPath)) {
Utilities.CopyFile (tempDotnetScriptPath, dotnetScriptPath);
Expand Down