<# launch.ps1 - Starts the Cuckoo Chess GUI desktop application. Launches the self-contained native app-image produced by build.ps1 (jpackage bundles its own Java runtime, so no external JDK is required). Outputs ONLY the numeric PID as the first line on stdout. #> $ErrorActionPreference = 'Stop' $exePath = (Join-Path (Split-Path $PSScriptRoot -Parent) 'install\CuckooChess\CuckooChess.exe') $proc = Start-Process -FilePath $exePath -PassThru Write-Output $proc.Id # Emit a trailing line so that when the caller does `$out = & powershell ... launch.ps1`, # $out is captured as an array (Object[]) and $out[0] is the full PID string. # With a single output line PowerShell collapses $out to a scalar string, making # $out[0] index the first CHARACTER of the PID instead of the whole number. Write-Output ""