fix: prevent orphaned processes from consuming 100% CPU when terminal closes (#16965)

Co-authored-by: Tommaso Sciortino <sciortino@gmail.com>
This commit is contained in:
Yuvraj Angad Singh
2026-02-27 04:47:09 +05:30
committed by GitHub
parent aa98cafca7
commit b8d6041d42
4 changed files with 234 additions and 6 deletions
+4 -1
View File
@@ -1216,6 +1216,8 @@ describe('startInteractiveUI', () => {
runExitCleanup: vi.fn(),
registerSyncCleanup: vi.fn(),
registerTelemetryConfig: vi.fn(),
setupSignalHandlers: vi.fn(),
setupTtyCheck: vi.fn(() => vi.fn()),
}));
beforeEach(() => {
@@ -1322,7 +1324,8 @@ describe('startInteractiveUI', () => {
// Verify all startup tasks were called
expect(getVersion).toHaveBeenCalledTimes(1);
expect(registerCleanup).toHaveBeenCalledTimes(4);
// 5 cleanups: mouseEvents, consolePatcher, lineWrapping, instance.unmount, and TTY check
expect(registerCleanup).toHaveBeenCalledTimes(5);
// Verify cleanup handler is registered with unmount function
const cleanupFn = vi.mocked(registerCleanup).mock.calls[0][0];