$ErrorActionPreference = "Stop"

$root = Split-Path -Parent $PSScriptRoot
$vector = Join-Path $root ".tools/vector-0.48.0-x86_64-pc-windows-msvc/bin/vector.exe"
$config = Join-Path $root "examples/java-demo-app/vector.yaml"

if (-not (Test-Path $vector)) {
  throw "Vector executable not found at $vector"
}

if (-not (Test-Path $config)) {
  throw "Vector config not found at $config"
}

$process = Start-Process -FilePath $vector `
  -ArgumentList "--config", $config `
  -WorkingDirectory $root `
  -PassThru

$process.Id
