MCPcopy Create free account
hub / github.com/codeaashu/claude-code / suspendStdin

Method suspendStdin

src/ink/ink.tsx:1366–1395  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

1364 }> = [];
1365 private wasRawMode = false;
1366 suspendStdin(): void {
1367 const stdin = this.options.stdin;
1368 if (!stdin.isTTY) {
1369 return;
1370 }
1371
1372 // Store and remove all 'readable' event listeners temporarily
1373 // This prevents Ink from consuming stdin while the editor is active
1374 const readableListeners = stdin.listeners('readable');
1375 logForDebugging(`[stdin] suspendStdin: removing ${readableListeners.length} readable listener(s), wasRawMode=${(stdin as NodeJS.ReadStream & {
1376 isRaw?: boolean;
1377 }).isRaw ?? false}`);
1378 readableListeners.forEach(listener => {
1379 this.stdinListeners.push({
1380 event: 'readable',
1381 listener: listener as (...args: unknown[]) => void
1382 });
1383 stdin.removeListener('readable', listener as (...args: unknown[]) => void);
1384 });
1385
1386 // If raw mode is enabled, disable it temporarily
1387 const stdinWithRaw = stdin as NodeJS.ReadStream & {
1388 isRaw?: boolean;
1389 setRawMode?: (mode: boolean) => void;
1390 };
1391 if (stdinWithRaw.isRaw && stdinWithRaw.setRawMode) {
1392 stdinWithRaw.setRawMode(false);
1393 this.wasRawMode = true;
1394 }
1395 }
1396 resumeStdin(): void {
1397 const stdin = this.options.stdin;
1398 if (!stdin.isTTY) {

Callers 2

enterAlternateScreenMethod · 0.95
editFileInEditorFunction · 0.80

Calls 3

logForDebuggingFunction · 0.85
forEachMethod · 0.80
pushMethod · 0.45

Tested by

no test coverage detected