Harden Show-FailureLogs.ps1 against failures where the files are not present between Get-ChildItem and the output of the file (#5454)

* Harden Show-FailureLogs.ps1 against failures where the files are not present between Get-ChildItem and the output of the file

* Also log .FullName
This commit is contained in:
Daniel Jurek 2024-05-06 15:44:34 -07:00 committed by GitHub
parent df8c4d4b2c
commit caa3010ece
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -8,6 +8,8 @@
$logFiles = Get-ChildItem -Recurse -Filter *.log
$filteredLogs = $logFiles.Where({ $_.Name -in ('vcpkg-bootstrap.log', 'vcpkg-manifest-install.log') })
$filteredLogs.FullName | Write-Host
if (!$filteredLogs) {
Write-Host "No logs found"
exit 0
@ -19,7 +21,11 @@ foreach ($logFile in $filteredLogs)
Write-Host "=============================================================================================================================="
Write-Host "Log file: $logFile"
Write-Host "=============================================================================================================================="
Get-Content $logFile | Write-Host
try {
Get-Content $logFile | Write-Host
} catch {
Write-Host "Could not locate file found using Get-ChildItem $logFile"
}
}
exit 0
exit 0