fix: max listners (#241)

This commit is contained in:
Kian Jones
2025-12-16 15:16:44 -05:00
committed by GitHub
parent 34eb87b014
commit 45f02dc96e

View File

@@ -1,4 +1,6 @@
// Import useInput from vendored Ink for bracketed paste support
import { EventEmitter } from "node:events";
import { stdin } from "node:process";
import { Box, Text, useInput } from "ink";
import SpinnerLib from "ink-spinner";
@@ -24,6 +26,14 @@ const COUNTER_VISIBLE_THRESHOLD = 1000;
// Window for double-escape to clear input
const ESC_CLEAR_WINDOW_MS = 2500;
// Increase max listeners to accommodate multiple useInput hooks
// (5 in this component + autocomplete components)
stdin.setMaxListeners(20);
// Also set default max listeners on EventEmitter prototype to prevent warnings
// from any EventEmitters that might not have their limit set properly
EventEmitter.defaultMaxListeners = 20;
export function Input({
visible = true,
streaming,