mirror of
https://github.com/NousResearch/hermes-agent.git
synced 2026-06-09 08:21:50 +00:00
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:
parent
6bdc4c0231
commit
4ce9caed04
2 changed files with 6 additions and 6 deletions
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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)
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue