Use subprocess
Some checks failed
Test / tests (darwin-amd64) (push) Successful in 21s
Test / tests (windows-amd64) (push) Failing after 23s
Test / tests (linux-amd64) (push) Successful in 25s
Run Gosec / tests (push) Successful in 51s
Test / tests (linux-arm64) (push) Has been cancelled

This commit is contained in:
2025-09-09 16:11:31 +02:00
parent aaabf0bd37
commit 58a8fe77a9

View File

@@ -16,10 +16,23 @@ $vaultArgs = @(
) )
Write-Output "✅ Starting Vault server..." Write-Output "✅ Starting Vault server..."
$process = Start-Process -FilePath "cmd.exe" -ArgumentList "/c start `"Vault Server`" /B .\vault.exe $vaultArgs" - $vaultJob = Start-Job -Name "VaultServer" -ScriptBlock {
param($Args)
& ".\vault.exe" $Args
} -ArgumentList $vaultArgs
$vaultPid = $process.Id # Wait a moment for the job to start
Write-Output "✅ Vault process started with PID: $vaultPid" Start-Sleep -Seconds 2
# Get the actual process ID from the job
$vaultProcess = Get-Process -Name "vault" -ErrorAction SilentlyContinue | Select-Object -First 1
if ($vaultProcess) {
$vaultProcess.Id | Out-File -FilePath "vault-pid.txt"
Write-Output "✅ Vault process started with PID: $($vaultProcess.Id)"
} else {
Write-Output "❌ Could not find Vault process"
exit 1
}
# Wait for Vault to become ready using port check # Wait for Vault to become ready using port check
$timeout = 30 $timeout = 30
@@ -28,7 +41,6 @@ $isReady = $false
$vaultPort = 8200 $vaultPort = 8200
Write-Output "🕐 Waiting for Vault to start on port $vaultPort..." Write-Output "🕐 Waiting for Vault to start on port $vaultPort..."
while ($counter -lt $timeout) { while ($counter -lt $timeout) {
# Check if process is still running # Check if process is still running
if (-not (Get-Process -Id $vaultPid -ErrorAction SilentlyContinue)) { if (-not (Get-Process -Id $vaultPid -ErrorAction SilentlyContinue)) {