feat(subprocess): Windows terminal inspection and signalling

createProcessInspector now returns a WindowsProcessInspector on win32
instead of throwing: Toolhelp32 tree enumeration with GetProcessTimes
start identities, the shell pid as a pseudo foreground group, taskkill
tree signalling, and inspector-verified Windows teardown (node-pty
signal kills throw on Windows, and externally taskkilled shells may
never fire its exit notification, so the handle settles \done\ from the
verified absence). subprocess-local and pty-local suites now run on
Windows with platform gates; the koffi-backed inspector joins the
windows-only coverage exclusions on Linux and is fully covered by the
windows-native lane.

Also flips vitest.config so subprocess-local and pty-local sources are
coverage-required on win32, and adapts the spawn/terminal suites to run
natively there (node-translated shell commands, injected POSIX group
paths, taskkill signal semantics).
This commit is contained in:
Huanqi Cao
2026-08-11 23:58:38 +08:00
parent 05a8846c6e
commit da403d6086
11 changed files with 809 additions and 46 deletions
+9 -6
View File
@@ -25,23 +25,26 @@ const windowsUnsupportedPackages = process.platform === 'win32'
// INCLUDED: PowerShell ships with Windows, so they run natively here.
// This explicit list (not a 'packages/bash/*' glob) keeps
// packages/bash/bash — the Service Definition package — running on Windows.
// subprocess-local and pty-local are NOT listed: their win32 branches are
// first-class (Windows inspector, pwsh dialect), so their suites run and
// their sources stay coverage-required on the windows-native lane; the
// bash-requiring tests inside them self-skip through hasBash probes.
'packages/bash/bash-local',
'packages/bash/bash-sandbox',
'packages/bash/tool-bash',
'packages/hooks/*',
'packages/subprocess/*',
'packages/pty/pty-local',
'packages/sandbox/sandbox-local',
]
: []
// Windows-only packages: their sources execute exclusively on win32 (koffi
// loads Win32 libraries), so the Linux coverage lane can never cover them.
// The Windows dev/CI lane exercises them through the probe/runner suites; the
// per-file 100% gate must not fail on their Linux-uncovered paths.
// Windows-only sources: they execute exclusively on win32 (koffi loads Win32
// libraries), so the Linux coverage lane can never cover them. The Windows
// dev/CI lane exercises them through the probe/runner suites; the per-file
// 100% gate must not fail on their Linux-uncovered paths.
const windowsOnlyCoverageExclusions = process.platform !== 'win32'
? [
'packages/sandbox/sandbox-windows-acl/src/**/*.ts',
'packages/subprocess/subprocess-local/src/windows-inspector.ts',
]
: []