From 09279e888b103d5ed6377ebcfa18eea69fe5cbc6 Mon Sep 17 00:00:00 2001 From: Nate Date: Fri, 15 Aug 2025 19:43:34 -0700 Subject: [PATCH] Fix stdin reading behavior in CI environments with TTY detection --- src/util/stdin.ts | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/src/util/stdin.ts b/src/util/stdin.ts index 83e775779..91c4db0dd 100644 --- a/src/util/stdin.ts +++ b/src/util/stdin.ts @@ -7,15 +7,20 @@ import * as fs from "fs"; export function readStdinSync(): string | null { try { // In test environments, don't attempt to read stdin to avoid hanging + // But allow CI environments to read stdin when it's clearly piped if ( process.env.NODE_ENV === "test" || process.env.VITEST === "true" || - process.env.JEST_WORKER_ID !== undefined || - process.env.CI === "true" + process.env.JEST_WORKER_ID !== undefined ) { return null; } + // Special handling for CI environments - allow reading if stdin is clearly not a TTY + if (process.env.CI === "true" && process.stdin.isTTY === true) { + return null; + } + // Check if stdin is a TTY (interactive terminal) if (process.stdin.isTTY === true) { // Definitely a TTY, don't read