fix(patch): cherry-pick 828afe1 to release/v0.20.0-preview.1-pr-14159 to patch version v0.20.0-preview.1 and create version 0.20.0-preview.2 (#14733)

Co-authored-by: Allen Hutchison <adh@google.com>
This commit is contained in:
gemini-cli-robot
2025-12-08 11:54:40 -08:00
committed by GitHub
parent aae64683ce
commit f9997f92c9
12 changed files with 31 additions and 24 deletions

View File

@@ -13,6 +13,11 @@ import stripAnsi from 'strip-ansi';
export class TextOutput {
private atStartOfLine = true;
private outputStream: NodeJS.WriteStream;
constructor(outputStream: NodeJS.WriteStream = process.stdout) {
this.outputStream = outputStream;
}
/**
* Writes a string to stdout.
@@ -22,7 +27,7 @@ export class TextOutput {
if (str.length === 0) {
return;
}
process.stdout.write(str);
this.outputStream.write(str);
const strippedStr = stripAnsi(str);
if (strippedStr.length > 0) {
this.atStartOfLine = strippedStr.endsWith('\n');