Skip to content

Commit

Permalink
Adjustments
Browse files Browse the repository at this point in the history
  • Loading branch information
kamronbatman committed Nov 21, 2024
1 parent 3ce056e commit 77a13b0
Showing 1 changed file with 20 additions and 12 deletions.
32 changes: 20 additions & 12 deletions procDump.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,20 @@ function Run-Process([string]$fileName, [string]$arguments) {
$processInfo.WorkingDirectory = $PSScriptRoot
$process = New-Object System.Diagnostics.Process
$process.StartInfo = $processInfo

$OutEvent = Register-ObjectEvent -Action {
Write-Host $Event.SourceEventArgs.Data
} -InputObject $process -EventName OutputDataReceived

$ErrEvent = Register-ObjectEvent -Action {
Write-Host $Event.SourceEventArgs.Data
} -InputObject $process -EventName ErrorDataReceived

$process.Start() | Out-Null

$process.BeginOutputReadLine()
$process.BeginErrorReadLine()

return $process
}

Expand All @@ -36,19 +49,14 @@ if (-not (Test-Path $filePath)) {
Unzip $zipFilePath $procDumpFolder
}

Write-Host "Running the schema generator"
Write-Host "Running schema generator"
#$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 -v $($toolProcess.Id) $procDumpFolder"

$dumpProcess.WaitForExit();
Write-Host "Running procdump"
$dumpProcess = Run-Process "$procDumpFolder\procdump.exe" "-accepteula -ma -h $($toolProcess.Id) $procDumpFolder"

Write-Host "Dump is finished"

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

Stop-Process -Id $toolProcess.Id

#Write-Host $toolProcess.StandardOutput.ReadToEnd();
#Write-Host $toolProcess.StandardError.ReadToEnd();
Write-Host "Waiting for proc dump exit"
while (-not $dumpProcess.HasExited) {
Start-Sleep -Seconds 1
}

0 comments on commit 77a13b0

Please sign in to comment.