<# launch.ps1 - Launch the SplitsTree App and report its PID. Starts the native jpackage-produced SplitsTree.exe (a self-contained JavaFX desktop GUI application) and writes the numeric process id as the FIRST line of stdout, as required by the pipeline harness. NOTE on output shape: the harness reads the pid with [int]$out[0] where $out is the captured stdout of & powershell -File launch.ps1 . PowerShell collapses a *single* output line to a scalar [string], which would make $out[0] the first CHARACTER, not the first line. Emitting a second line forces $out to be a [string[]] array so that $out[0] is the whole first line (the pid). The pid is always the first line and no text precedes it. This script is standalone: it does not require build.ps1 to have run in the same session, it only requires the app image to exist in the install dir. #> $ErrorActionPreference = 'Stop' $Exe = (Join-Path (Split-Path $PSScriptRoot -Parent) 'install\SplitsTree\SplitsTree.exe') if (-not (Test-Path $Exe)) { Write-Error "SplitsTree executable not found at $Exe. Run build.ps1 first." exit 1 } # Launch the GUI application from its own directory so it can locate its # bundled runtime and resources. $WorkDir = Split-Path $Exe -Parent $proc = Start-Process -FilePath $Exe -WorkingDirectory $WorkDir -PassThru Write-Output $proc.Id Write-Output "SplitsTree launched (pid $($proc.Id))"