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

(GH-872) Progress output never reaches completion #873

Closed
wants to merge 3 commits into from
Closed
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
4 changes: 2 additions & 2 deletions src/chocolatey.resources/helpers/functions/Get-FtpFile.ps1
Expand Up @@ -26,7 +26,7 @@ FileName location specified.
This is a low-level function and not recommended for use in package
scripts. It is recommended you call `Get-ChocolateyWebFile` instead.

Starting in 0.9.10, will automatically call Set-PowerShellExitCode to
Starting in 0.9.10, will automatically call Set-PowerShellExitCode to
set the package exit code to 404 if the resource is not found.

.INPUTS
Expand Down Expand Up @@ -160,7 +160,7 @@ param(
Write-Progress "Downloading $url to $fileName" "Saving $total bytes..." -id 0 -Completed
}
if ($total -eq $goal) {
Write-Progress "Completed download of $url." "Completed a total of $total bytes of $fileName" -id 0 -Completed
Write-Progress "Completed download of $url." "Completed a total of $total bytes of $fileName" -id 0 -Completed -PercentComplete 100
}
}
} while ($count -ne 0)
Expand Down
2 changes: 1 addition & 1 deletion src/chocolatey.resources/helpers/functions/Get-WebFile.ps1
Expand Up @@ -282,7 +282,7 @@ param(
}

if ($total -eq $goal) {
Write-Progress "Completed download of $url." "Completed download of $fileName ($goalFormatted)." -id 0 -Completed
Write-Progress "Completed download of $url." "Completed download of $fileName ($goalFormatted)." -id 0 -Completed -PercentComplete 100
}
}
} while ($count -gt 0)
Expand Down
Expand Up @@ -118,11 +118,10 @@ public override void WriteDebugLine(string message)
}

private bool hasLoggedStartProgress = false;
private bool hasLoggedFinalProgress = false;
public override void WriteProgress(long sourceId, ProgressRecord record)
{
if (record.PercentComplete == -1) return;
if (hasLoggedFinalProgress) return;

if (!hasLoggedStartProgress)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

{
hasLoggedStartProgress = true;
Expand All @@ -131,13 +130,6 @@ public override void WriteProgress(long sourceId, ProgressRecord record)

// http://stackoverflow.com/a/888569/18475
Console.Write("\rProgress: {0}% - {1}".format_with(record.PercentComplete.to_string(), record.StatusDescription.PadRight(50, ' ')));

if (record.PercentComplete == 100 && !hasLoggedFinalProgress)
{
hasLoggedFinalProgress = true;
//this.Log().Info("");
//this.Log().Info(record.StatusDescription.Replace("Saving","Finished downloading. Saved"));
}
}

public override void WriteVerboseLine(string message)
Expand Down