mirror of
https://github.com/google-gemini/gemini-cli.git
synced 2026-03-22 12:01:39 -07:00
refactor(stdio): always patch stdout and use createWorkingStdio for clean output (#14159)
This commit is contained in:
@@ -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');
|
||||
|
||||
Reference in New Issue
Block a user