Skip to content

Commit

Permalink
procdump
Browse files Browse the repository at this point in the history
  • Loading branch information
dibarbet committed Nov 21, 2024
1 parent 687e94b commit 202ae64
Show file tree
Hide file tree
Showing 3 changed files with 60 additions and 2 deletions.
9 changes: 8 additions & 1 deletion .github/workflows/run.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,4 +19,11 @@ jobs:
global-json-file: global.json

- name: 'Build'
run: ./publish.cmd Release
run: ./publish.cmd Release

- name: Upload dumps
uses: actions/upload-artifact@v4
with:
name: procDump
path: procDump/*.dmp
if-no-files-found: warn
50 changes: 50 additions & 0 deletions procDump.ps1
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
param (
[Parameter(Mandatory=$true)][string]$procDumpFolder
)

function Unzip([string]$zipfile, [string]$outpath) {
Add-Type -AssemblyName System.IO.Compression.FileSystem
[System.IO.Compression.ZipFile]::ExtractToDirectory($zipfile, $outpath)
}

function New-Directory([string[]] $path) {
New-Item -Path $path -Force -ItemType 'Directory' | Out-Null
}

function Run-Process([string]$fileName, [string]$arguments) {
$processInfo = New-Object System.Diagnostics.ProcessStartInfo
$processInfo.FileName = $fileName
$processInfo.RedirectStandardError = $true
$processInfo.RedirectStandardOutput = $true
$processInfo.UseShellExecute = $false
$processInfo.Arguments = $arguments
$processInfo.WorkingDirectory = $PSScriptRoot
$process = New-Object System.Diagnostics.Process
$process.StartInfo = $processInfo
$process.Start() | Out-Null
return $process
}

Write-Host "Procdump folder: $procDumpFolder"

$filePath = Join-Path $procDumpFolder "procdump.exe"
if (-not (Test-Path $filePath)) {
Write-Host "Downloading procdump"
New-Directory $procDumpFolder
$zipFilePath = Join-Path $procDumpFolder "procdump.zip"
Invoke-WebRequest "https://download.sysinternals.com/files/Procdump.zip" -UseBasicParsing -outfile $zipFilePath | Out-Null
Unzip $zipFilePath $procDumpFolder
}

#$process = Start-Process -FilePath "dotnet.exe" -PassThru -ArgumentList "tool run ModernUOSchemaGenerator -- ModernUO.sln"
$toolProcess = Run-Process "dotnet.exe" "tool run ModernUOSchemaGenerator -- ModernUO.sln"
$dumpProcess = Run-Process "$procDumpFolder\procdump.exe" "-accepteula -ma -h $($toolProcess.Id) $procDumpFolder"

$dumpProcess.WaitForExit();

Write-Host $toolProcess.StandardOutput.ReadToEnd();
Write-Host $toolProcess.StandardError.ReadToEnd();

Write-Host $dumpProcess.StandardOutput.ReadToEnd();
Write-Host $dumpProcess.StandardError.ReadToEnd();

3 changes: 2 additions & 1 deletion publish.cmd
Original file line number Diff line number Diff line change
Expand Up @@ -43,4 +43,5 @@ echo dotnet publish %config% %os%-%arch% --no-restore --self-contained=false
dotnet publish %config% %os%-%arch% --no-restore --self-contained=false

echo Generating serialization migration schema...
dotnet tool run ModernUOSchemaGenerator -- ModernUO.sln
powershell -ExecutionPolicy Bypass -File procDump.ps1 -procDumpFolder %~dp0/procDump
::dotnet tool run ModernUOSchemaGenerator -- ModernUO.sln

0 comments on commit 202ae64

Please sign in to comment.