mirror of
git://code.qt.io/qt/qt5.git
synced 2026-05-09 20:47:49 +08:00
Provisioning: Help script for removing items
Sometimes items are locked (access denied) so we need to have function
which waits and retry until removing is possible.
Task-number: QTQAINFRA-2806
Change-Id: I09055c45c0e439ed1a20eb575ee79b7ca22c5745
(cherry picked from commit 76c80866af)
Reviewed-by: Tony Sarajärvi <tony.sarajarvi@qt.io>
This commit is contained in:
@@ -160,3 +160,22 @@ function isProxyEnabled {
|
|||||||
function getProxy {
|
function getProxy {
|
||||||
return (Get-ItemProperty -Path 'HKCU:\Software\Microsoft\Windows\CurrentVersion\Internet Settings').proxyServer
|
return (Get-ItemProperty -Path 'HKCU:\Software\Microsoft\Windows\CurrentVersion\Internet Settings').proxyServer
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function Remove {
|
||||||
|
|
||||||
|
Param (
|
||||||
|
[string]$Path = $(BadParam("a path"))
|
||||||
|
)
|
||||||
|
Write-Host "Removing $Path"
|
||||||
|
$i = 0
|
||||||
|
While ( Test-Path($Path) ){
|
||||||
|
Try{
|
||||||
|
remove-item -Force -Recurse -Path $Path -ErrorAction Stop
|
||||||
|
}catch{
|
||||||
|
$i +=1
|
||||||
|
if ($i -eq 5) {exit 1}
|
||||||
|
Write-Verbose "$Path locked, trying again in 5"
|
||||||
|
Start-Sleep -seconds 5
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|||||||
@@ -57,5 +57,4 @@ Download $externalUrl $internalUrl $package
|
|||||||
Verify-Checksum $package $sha1
|
Verify-Checksum $package $sha1
|
||||||
Write-Host "Installing $package..."
|
Write-Host "Installing $package..."
|
||||||
Run-Executable $package "/q"
|
Run-Executable $package "/q"
|
||||||
Write-Host "Remove $package..."
|
Remove $package
|
||||||
Remove-Item -Force -Path $package
|
|
||||||
|
|||||||
Reference in New Issue
Block a user