Files
VoxelForge/Standalone/Research/OwnerShapeWorld/round2/RunLimited.ps1
T
Fr0zkaandClaude Opus 5.5 7e3f926352 wip(standalone): shape-world join blends (room 12, strata/cave 3) -- source restored to last passing set, not rebuilt
Luna's continuation stopped when Windows could not start new processes (0xC0000142, low memory).
Fixed-view join step: chamber 0.041, tunnel 0.434 (bar 0.450, barely). Routes 5642/5642 open.
Shape stages 0.963 s / 0.870 s. Floor join plates still visible; final checks not run.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01MmSoF64BbRFmk9C3p1VsBJ
2026-10-04 00:07:00 +02:00

49 lines
2.1 KiB
PowerShell

[CmdletBinding()]
param(
[Parameter(Mandatory=$true)][string]$ExecutableName,
[Parameter(Mandatory=$true)][string[]]$ExecutableArguments,
[Parameter(Mandatory=$true)][string]$LogStem,
[double]$MemoryLimitGB = 6.0
)
$ErrorActionPreference = 'Stop'
$RoundDir = [IO.Path]::GetFullPath($PSScriptRoot)
$StandaloneRoot = [IO.Path]::GetFullPath((Join-Path $PSScriptRoot '..\..\..'))
if ([IO.Path]::GetFileName($ExecutableName) -ne $ExecutableName) { throw 'ExecutableName must be a filename.' }
if ([IO.Path]::GetFileName($LogStem) -ne $LogStem) { throw 'LogStem must be a filename stem.' }
$ExecutablePath = Join-Path (Join-Path $StandaloneRoot 'bin') $ExecutableName
if (-not (Test-Path -LiteralPath $ExecutablePath -PathType Leaf)) { throw "Executable not found: $ExecutablePath" }
$StdoutPath = Join-Path $RoundDir ($LogStem + '.stdout.log')
$StderrPath = Join-Path $RoundDir ($LogStem + '.stderr.log')
$HostProcess = Get-Process -Id $PID
$HostProcess.PriorityClass = 'BelowNormal'
$HostProcess.ProcessorAffinity = [IntPtr]0xFF00
$Child = Start-Process -FilePath $ExecutablePath -ArgumentList $ExecutableArguments `
-WorkingDirectory $StandaloneRoot -WindowStyle Hidden -PassThru `
-RedirectStandardOutput $StdoutPath -RedirectStandardError $StderrPath
$KilledForMemory = $false
$PeakWorkingSet = 0L
while (-not $Child.HasExited) {
$Child.Refresh()
if ($Child.HasExited) { break }
$Child.PriorityClass = 'BelowNormal'
$Child.ProcessorAffinity = [IntPtr]0xFF00
$PeakWorkingSet = [Math]::Max($PeakWorkingSet,$Child.WorkingSet64)
if ($Child.WorkingSet64 -gt $MemoryLimitGB * 1GB) {
$KilledForMemory = $true
Stop-Process -Id $Child.Id -Force
break
}
Start-Sleep -Milliseconds 500
}
$Child.WaitForExit()
$Child.Refresh()
if ($KilledForMemory) {
Write-Output "ABORTED_MEMORY_LIMIT pid=$($Child.Id) peak_observed_gb=$([math]::Round($PeakWorkingSet/1GB,2)) limit_gb=$MemoryLimitGB"
exit 98
}
Write-Output "RUN_EXIT pid=$($Child.Id) priority=BelowNormal affinity=0xFF00 peak_observed_gb=$([math]::Round($PeakWorkingSet/1GB,2)) exit_code=$($Child.ExitCode)"
exit $Child.ExitCode