fix: guarded terminal control sequences behind isTTY checks
- Skipped thinking-line writes and clears when stdout is not a TTY. - Prevented terminal title (set/push/pop) from emitting OSC/xterm escape sequences to piped or non-interactive output. - Suppressed all ProcessTerminal control writes when stdout isn't a TTY.
This commit is contained in:
@@ -79,12 +79,14 @@ export async function runCommitAgentSession(input: CommitAgentInput): Promise<Co
|
||||
let thinkingLineActive = false;
|
||||
const toolArgsById = new Map<string, { name: string; args?: Record<string, unknown> }>();
|
||||
const writeThinkingLine = (text: string) => {
|
||||
if (!process.stdout.isTTY) return;
|
||||
const line = chalk.dim(`… ${text}`);
|
||||
process.stdout.write(`\r\x1b[2K${line}`);
|
||||
thinkingLineActive = true;
|
||||
};
|
||||
const clearThinkingLine = () => {
|
||||
if (!thinkingLineActive) return;
|
||||
if (!process.stdout.isTTY) return;
|
||||
process.stdout.write("\r\x1b[2K");
|
||||
thinkingLineActive = false;
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user