Component evidence

hasInteractiveTerminal (utils/interactive-terminal.ts)

takt · src/shared/utils/interactive-terminal.ts · typescript · MIT
cli

Checks if process owns a TTY for terminal detection in CLI apps.

Source preview public preview
// Source: https://github.com/nrslib/takt | License: MIT | Copyright 2026 Masanobu Naruse
// Provided via justclaw.it.com; keep this notice with the code.
/**
 * Whether this process owns a terminal on both ends.
 *
 * Every front-end that can run either on the Ink TUI or through the readline
 * reader asks the same question, and asking it in one place is what keeps the
 * two paths from drifting apart: a run that renders frames must also be able to
 * read keys, so both streams have to be a TTY.
 */
export function hasInteractiveTerminal(): boolean {
  return process.stdin.isTTY === true && process.stdout.isTTY === true;
}