feat(native-host): kill previous instance on startup and in installers
CI / Build & Test (push) Failing after 3m39s

- Add kill-previous-instance.js with PID lock file under BASE_DIR
- On startup, send SIGTERM to any existing native-host process before binding ports
- Register removePidFile on shutdown and exit so the lock is cleared
- Run "stop any running native host" at the start of install.sh and install.ps1
- Add kill-previous-instance.js to CI syntax check
This commit is contained in:
Raven Scott
2026-03-14 23:22:43 -04:00
parent 2693e39040
commit 3bf9851390
5 changed files with 84 additions and 6 deletions
+5 -2
View File
@@ -20,6 +20,10 @@ Write-Host "==========================" -ForegroundColor Cyan
Write-Host "Install : $InstallDir"
Write-Host ""
# ── Stop any running native host first ─────────────────────────────────────────
Write-Host "Stopping any running native host..."
Get-Process | Where-Object { $_.Path -like "*holesail-browser-host*" } | Stop-Process -Force -ErrorAction SilentlyContinue
# ── Preserve user data from any previous installation ─────────────────────────
$StashDir = Join-Path $env:TEMP "holesail-browser-stash-$([System.Guid]::NewGuid().ToString('N'))"
$StashStorage = Join-Path $StashDir "holesail-browser-storage"
@@ -42,9 +46,8 @@ if (Test-Path $InstallDir) {
$HadPrevious = $true
}
# ── Stop any running instance ──────────────────────────────────────────────────
# ── Remove previous installation ──────────────────────────────────────────────
Write-Host "Removing any previous installation..."
Get-Process | Where-Object { $_.Path -like "*holesail-browser-host*" } | Stop-Process -Force -ErrorAction SilentlyContinue
if (Test-Path $InstallDir) { Remove-Item $InstallDir -Recurse -Force }
# Remove old registry entries
+6 -3
View File
@@ -34,6 +34,11 @@ echo "Platform : ${PLATFORM}-${ARCH}"
echo "Install : ${INSTALL_DIR}"
echo ""
# ── Stop any running native host first ────────────────────────────────────────
echo "Stopping any running native host..."
pkill -f "holesail-browser/native-host/index.mjs" 2>/dev/null || true
pkill -f "holesail-browser-host" 2>/dev/null || true
# ── Preserve user data from any previous installation ─────────────────────────
STASH_DIR="$(mktemp -d)"
STASH_STORAGE="${STASH_DIR}/holesail-browser-storage"
@@ -51,10 +56,8 @@ if [[ -d "$INSTALL_DIR" ]]; then
HAD_PREVIOUS=true
fi
# ── Stop any running instance ──────────────────────────────────────────────────
# ── Remove previous installation ──────────────────────────────────────────────
echo "Removing any previous installation..."
pkill -f "holesail-browser/native-host/index.mjs" 2>/dev/null || true
pkill -f "holesail-browser-host" 2>/dev/null || true
rm -rf "$INSTALL_DIR"
# Remove old native messaging manifests