5 lines
474 B
TypeScript
5 lines
474 B
TypeScript
// Whether a prompt can ask on stdin. STOREBOUND_ASSUME_TTY=1 treats piped stdin as the terminal, so the release
|
|
// acceptance matrix (tools/acceptance.ts) drives the real [y/N] and [Y/n] prompts with piped answers ("n\n", EOF) on
|
|
// every platform and runtime: the same reading code a person's terminal goes through.
|
|
export const stdinIsTTY = (env: Record<string, string | undefined> = process.env): boolean =>
|
|
env.STOREBOUND_ASSUME_TTY === '1' || !!process.stdin.isTTY;
|