Reduce truncation of information in the runningProcesses*.txt files (#12398)

- widen lines in process dump files
- increase process dump frequency to once every 2 minutes (from 5 minutes)
- simplify process dump filenames
  - no need to keep files from previous ./build.ps1 invocations around
  - by definition, job isn't hung if it can move to next build step
- save previous process dump files
  - should help if cancellation kills processes before final process dump runs

nits:
- move from deprecated `Get-WmiObject` to `Get-CimInstance`
- trim trailing whitespace
This commit is contained in:
Doug Bunting 2019-07-25 22:27:45 -07:00 committed by GitHub
parent e78d17e07b
commit 922baf932e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 14 additions and 6 deletions

View File

@ -1,9 +1,17 @@
Set-Location $args[0]
$timestamp = $(get-date -f MM-dd-HH-mm)
while ($true) {
Get-Process > artifacts/log/runningProcesses.$timestamp.txt
Get-WmiObject Win32_Process | select name, processid, commandline > artifacts/log/runningProcessesCommandLine.$timestamp.txt
Start-Sleep -Seconds 300
$local:file = "artifacts/log/runningProcesses.txt"
if (Test-Path $file) {Move-Item -Force $file "$file.bak"}
$local:temp = Get-Process |Out-String -Width 300
$temp.Split([Environment]::NewLine).TrimEnd() |? Length -gt 0 |Out-File -Width 300 $file
$file = "artifacts/log/runningProcessesCommandLine.txt"
if (Test-Path $file) {Move-Item -Force $file "$file.bak"}
$temp = Get-CimInstance Win32_Process |Format-Table -AutoSize Name, ProcessId, CommandLine |Out-String -Width 800
$temp.Split([Environment]::NewLine).TrimEnd() |? Length -gt 0 |Out-File -Width 800 $file
Start-Sleep -Seconds 120
}