Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 24 additions & 4 deletions diagnostics/collect-wsl-logs.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -328,8 +328,28 @@ if ($Dump)
}
}

$logArchive = "$(Resolve-Path $folder).zip"
Compress-Archive -Path $folder -DestinationPath $logArchive
Remove-Item $folder -Recurse
$logArchive = "$(Resolve-Path $folder).tar.gz"
tar.exe -czf $logArchive $folder
if ($LASTEXITCODE -eq 0)
{
Remove-Item $folder -Recurse
Write-Host -ForegroundColor Green "Logs saved in: $logArchive. Please attach that file to the GitHub issue."
}
else
{
Remove-Item $logArchive -ErrorAction Ignore

Write-Host -ForegroundColor Green "Logs saved in: $logArchive. Please attach that file to the GitHub issue."
# Fall back to zip if tar fails (e.g. on SKUs that lack tar.exe)
$logArchive = "$(Resolve-Path $folder).zip"
try
{
Compress-Archive -Path $folder -DestinationPath $logArchive -Force
Remove-Item $folder -Recurse
Write-Host -ForegroundColor Green "Logs saved in: $logArchive. Please attach that file to the GitHub issue."
}
catch
{
Remove-Item $logArchive -ErrorAction Ignore
Write-Host -ForegroundColor Red "Failed to compress logs. They are available in: $(Resolve-Path $folder)"
}
}