fix(tui): type execFileNoThrow stdio/ChildProcess and make memoryMonitor critical test heap-independent (#40612)

Salvaged from #40415; re-verified on main, tightened, tested.

Co-authored-by: psionic73 <psionic73@users.noreply.github.com>
This commit is contained in:
Teknium 2026-06-07 18:23:42 -07:00 committed by GitHub
parent 6bdc4c0231
commit 4ce9caed04
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 6 additions and 6 deletions

View file

@ -1,4 +1,4 @@
import { spawn } from 'child_process'
import { spawn, type ChildProcess, type StdioOptions } from 'child_process'
type ExecFileOptions = {
input?: string
timeout?: number
@ -32,11 +32,11 @@ export function execFileNoThrow(
// doesn't inherit those pipe FDs — prevents handle leaks that can
// keep the parent process alive. No output data is collected in
// this mode; both stdout and stderr will be empty strings.
const stdioConfig = options.resolveOnExit
? ['pipe', 'ignore', 'ignore'] as const
: 'pipe' as const
const stdioConfig: StdioOptions = options.resolveOnExit
? ['pipe', 'ignore', 'ignore']
: 'pipe'
const child = spawn(file, args, {
const child: ChildProcess = spawn(file, args, {
cwd: options.useCwd ? process.cwd() : undefined,
env: options.env,
stdio: stdioConfig

View file

@ -42,7 +42,7 @@ describe('startMemoryMonitor thresholds (#34095)', () => {
// ceiling. With relative thresholds (~88%), 2.5GB is well within normal.
const onCritical = vi.fn()
withHeap(2.5 * GB)
stop = startMemoryMonitor({ intervalMs: 1, onCritical })
stop = startMemoryMonitor({ criticalBytes: 7 * GB, highBytes: 5 * GB, intervalMs: 1, onCritical })
await vi.advanceTimersByTimeAsync(5)