Datasets:
File size: 1,357 Bytes
598838a | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 | <#
launch.ps1 - Starts the Logbert GUI application.
Emits ONLY the numeric process id of the launched application as the first
line of stdout (via Write-Output). The build/verification pipeline reads
this PID to manage the process, so nothing else may be written before it.
This script is standalone: it does not require build.ps1 to have run in the
same session, it only requires the application to be installed at the path
below (which build.ps1 produces).
#>
$ErrorActionPreference = 'Stop'
$InstallDir = (Join-Path (Split-Path $PSScriptRoot -Parent) 'install')
$ExePath = Join-Path $InstallDir 'Logbert.exe'
if (-not (Test-Path $ExePath)) {
throw "Logbert.exe not found at $ExePath. Run build.ps1 first."
}
# Launch the GUI with its own directory as the working directory so it finds
# its config and sibling assemblies.
$proc = Start-Process -FilePath $ExePath -WorkingDirectory $InstallDir -PassThru
Write-Output $proc.Id
# Emit a trailing newline so a caller that does `$out = & powershell -File
# launch.ps1; $appPid = [int]$out[0]` receives an ARRAY of lines (whose [0] is
# the PID string) rather than a single scalar string (whose [0] would be the
# first *character* of the PID). This keeps the mandated PID-first-line
# contract while making the captured output robust to line-indexing.
Write-Output ''
|