Skip to content

Commit 5705fdc

Browse files
committed
Print removal errors as warnings
1 parent 6038669 commit 5705fdc

File tree

1 file changed

+10
-5
lines changed

1 file changed

+10
-5
lines changed

src/ci/scripts/free-disk-space-windows.ps1

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -15,13 +15,18 @@ $dirs = 'C:\Program Files\Microsoft Visual Studio\2022\Enterprise\VC\Tools\Llvm'
1515
'C:\Strawberry', 'C:\hostedtoolcache\windows\Java_Temurin-Hotspot_jdk'
1616

1717
foreach ($dir in $dirs) {
18-
Remove-Item -Recurse -Force -ErrorAction Continue $dir &
18+
Start-ThreadJob -InputObject $dir {
19+
Remove-Item -Recurse -Force -LiteralPath $input
20+
} | Out-Null
1921
}
2022

21-
# Wait for deletion to finish
22-
Get-Job -State Running | Wait-Job
23-
# Cleanup finished jobs
24-
Get-Job | Remove-Job
23+
foreach ($job in Get-Job) {
24+
Wait-Job $job | Out-Null
25+
if ($job.Error) {
26+
Write-Output "::warning file=$PSCommandPath::$($job.Error)"
27+
}
28+
Remove-Job $job
29+
}
2530

2631
Get-Volume | Out-String | Write-Output
2732

0 commit comments

Comments
 (0)