fix #15369, prevent crash on unhandled EIO error in readStdin cleanup (#15410)

Co-authored-by: Gaurav <39389231+gsquared94@users.noreply.github.com>
This commit is contained in:
ElecTwix
2025-12-22 23:50:43 +03:00
committed by GitHub
parent 9c48cd849b
commit 0a216b28f3
3 changed files with 105 additions and 0 deletions
+4
View File
@@ -21,6 +21,8 @@ const mockStdin = {
on: vi.fn(),
removeListener: vi.fn(),
destroy: vi.fn(),
listeners: vi.fn().mockReturnValue([]),
listenerCount: vi.fn().mockReturnValue(0),
};
describe('readStdin', () => {
@@ -48,6 +50,8 @@ describe('readStdin', () => {
if (event === 'error') onErrorHandler = handler as (err: Error) => void;
},
);
mockStdin.listeners.mockReturnValue([]);
mockStdin.listenerCount.mockReturnValue(0);
});
afterEach(() => {