-
Notifications
You must be signed in to change notification settings - Fork 4.7k
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
Fix retry when downloading clang tools #59806
Fix retry when downloading clang tools #59806
Conversation
Invoke-WebRequest throws an exception when the download fails, so we should use try-catch instead of status code to check failure. In addition pass -PassThru to avoid leaving a corrupted download file in case the download fails. This will buffer the download and write it once at the end. Fix dotnet#57196
Tagging subscribers to this area: @JulieLeeMSFT Issue DetailsInvoke-WebRequest throws an exception when the download fails, so we In addition pass -PassThru to avoid leaving a corrupted download file in Fix #57196 I used clumsy to verify that this works. In those tests I also noticed that on PowerShell 7, Invoke-WebRequest with -OutFile but without -PassThru sometimes does not detect when the download fails. It seems to work reliably with -PassThru though. There is already an issue for it: PowerShell/PowerShell#16122
|
I wonder if we can easily re-use this function there |
Good idea! Done. |
Thanks for fixing this! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Awesome, thanks.
Invoke-WebRequest throws an exception when the download fails, so we
should use try-catch instead of status code to check failure.
In addition pass -PassThru to avoid leaving a corrupted download file in
case the download fails. This will buffer the download and write it once
at the end.
Fix #57196
I used clumsy to verify that this works. In those tests I also noticed that on PowerShell 7, Invoke-WebRequest with -OutFile but without -PassThru sometimes does not detect when the download fails. It seems to work reliably with -PassThru though. There is already an issue for it: PowerShell/PowerShell#16122