Improve handling of Adobe's CC Cleaner tool (#1635)

* Update close-old-issues.yaml

* Compile Winutil

* Update close-old-issues.yaml

* Update close-old-issues.yaml

* Update close-old-issues.yaml

* Improve handling of Adobe's CC Cleaner tool

This PR implements a try-catch-finally struct to do a better handling of Adobe's Creative Cloud Cleaner tool downloading and running of such program.

This will allow to see any errors that occurs if the URL changes, the tool fails to run, or anything else.

I also have moved the cleaning up process to the finally part of the structure, as it makes the most sense.

This tries to fix or sanitize the issue #1563.

---------

Co-authored-by: Chris Titus <dfm.titus@gmail.com>
Co-authored-by: ChrisTitusTech <ChrisTitusTech@users.noreply.github.com>
Co-authored-by: Chris Titus <contact@christitus.com>
This commit is contained in:
Ken Hoo 2024-02-22 01:32:14 +00:00 committed by GitHub
parent 420f37f205
commit 4ac5b79fc8
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -11,18 +11,22 @@ function Invoke-WPFRunAdobeCCCleanerTool {
Write-Host "The Adobe Creative Cloud Cleaner tool is hosted at"
Write-Host "$url"
# Don't show the progress because it will slow down the download speed
$ProgressPreference='SilentlyContinue'
try {
# Don't show the progress because it will slow down the download speed
$ProgressPreference='SilentlyContinue'
Invoke-WebRequest -Uri $url -OutFile "$env:TEMP\AdobeCreativeCloudCleanerTool.exe" -UseBasicParsing -ErrorAction SilentlyContinue -Verbose
Invoke-WebRequest -Uri $url -OutFile "$env:TEMP\AdobeCreativeCloudCleanerTool.exe" -UseBasicParsing -ErrorAction SilentlyContinue -Verbose
# Revert back the ProgressPreference variable to the default value since we got the file desired
$ProgressPreference='Continue'
# Revert back the ProgressPreference variable to the default value since we got the file desired
$ProgressPreference='Continue'
Start-Process -FilePath "$env:TEMP\AdobeCreativeCloudCleanerTool.exe" -Wait -ErrorAction SilentlyContinue -Verbose
if (Test-Path -Path "$env:TEMP\AdobeCreativeCloudCleanerTool.exe") {
Write-Host "Cleaning up..."
Remove-Item -Path "$env:TEMP\AdobeCreativeCloudCleanerTool.exe" -Verbose
Start-Process -FilePath "$env:TEMP\AdobeCreativeCloudCleanerTool.exe" -Wait -ErrorAction SilentlyContinue -Verbose
} catch {
Write-Error $_.Exception.Message
} finally {
if (Test-Path -Path "$env:TEMP\AdobeCreativeCloudCleanerTool.exe") {
Write-Host "Cleaning up..."
Remove-Item -Path "$env:TEMP\AdobeCreativeCloudCleanerTool.exe" -Verbose
}
}
}