diagnostic: identify surviving Git Bash fixture processes

This commit is contained in:
Neil
2026-09-06 03:13:17 -07:00
parent 79cfb1fad7
commit 4b7dfbd609
2 changed files with 13 additions and 2 deletions
@@ -66,6 +66,7 @@ jobs:
run: >-
pnpm run test:e2e
tests/e2e/golden-tab-bar-agent-launch.spec.ts
--grep "under git-bash"
--repeat-each=3
--workers=1
+12 -2
View File
@@ -8,6 +8,7 @@
import { execFileSync } from 'node:child_process'
import { readFileSync, existsSync, realpathSync, rmSync } from 'node:fs'
import { TEST_REPO_PATH_FILE } from './global-setup'
import { readWindowsProcessTableFresh } from '../../src/main/windows/windows-process-table'
export function linkedWorktreePaths(testRepoDir: string): string[] {
const root = realpathSync.native(testRepoDir)
@@ -61,14 +62,23 @@ export function cleanupTestRepository(testRepoDir: string): void {
}
}
export default function globalTeardown(): void {
export default async function globalTeardown(): Promise<void> {
if (!existsSync(TEST_REPO_PATH_FILE)) {
return
}
const testRepoDir = readFileSync(TEST_REPO_PATH_FILE, 'utf-8').trim()
if (testRepoDir && existsSync(testRepoDir)) {
cleanupTestRepository(testRepoDir)
try {
cleanupTestRepository(testRepoDir)
} catch (error) {
const rows = await readWindowsProcessTableFresh()
const selected = rows.filter((row) => /^(?:sh|bash|node)\.exe$/i.test(row.name))
const parents = new Set(selected.map((row) => row.ppid))
console.error('TEARDOWN_PROCESS_ROWS', JSON.stringify(rows.filter((row) =>
selected.includes(row) || parents.has(row.pid))))
throw error
}
console.error(`[e2e] Cleaned up test repo at ${testRepoDir}`)
}