forked from aspnet/Mvc
-
Notifications
You must be signed in to change notification settings - Fork 0
/
runWithProcDump.ps1
37 lines (33 loc) · 1.11 KB
/
runWithProcDump.ps1
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
try
{
$cwd = $PSScriptRoot;
$job = Start-Job {
$dumpsFolder = "${using:cwd}/artifacts/dumps";
mkdir $dumpsFolder -Force;
$procDumpFolder = "${using:cwd}/obj";
mkdir $procDumpFolder -Force;
$procDumpFolder = Resolve-Path $procDumpFolder;
Invoke-WebRequest https://download.sysinternals.com/files/Procdump.zip -OutFile "$procDumpFolder/procdump.zip";
Expand-Archive "$procDumpFolder/procdump.zip" -DestinationPath "$procDumpFolder" -Force;
$sleepTime = (1 * 20 * 60)
Start-Sleep -Seconds $sleepTime;
Write-Host "Producing dumps in $dumpsFolder";
Write-Host "Process dumps to capture:"
$processes = Get-Process dotnet*, testhost*;
$processes | Format-Table;
Write-Host "Using ProcDump from $procDumpFolder/procdump.exe";
$processes |
Select-Object -ExpandProperty ID |
ForEach-Object { &"$procDumpFolder/procdump.exe" -accepteula -ma $_ $dumpsFolder }
}
Write-Host "Process dump capture job started. Running run.ps1 next";
./run.ps1 default-build @args
# Receive-Job $job
Stop-Job $job
Remove-Job $job
}
catch
{
write-host $_
exit -1;
}