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
+1 -1
View File
@@ -48,7 +48,7 @@ vi.mock('../utils/browser.js', () => ({
vi.mock('../utils/stdio.js', () => ({
writeToStdout: vi.fn(),
writeToStderr: vi.fn(),
createInkStdio: vi.fn(() => ({
createWorkingStdio: vi.fn(() => ({
stdout: process.stdout,
stderr: process.stderr,
})),
+2 -2
View File
@@ -33,7 +33,7 @@ import { FORCE_ENCRYPTED_FILE_ENV_VAR } from '../mcp/token-storage/index.js';
import { debugLogger } from '../utils/debugLogger.js';
import {
writeToStdout,
createInkStdio,
createWorkingStdio,
writeToStderr,
} from '../utils/stdio.js';
import {
@@ -334,7 +334,7 @@ async function authWithUserCode(client: OAuth2Client): Promise<boolean> {
const code = await new Promise<string>((resolve, _) => {
const rl = readline.createInterface({
input: process.stdin,
output: createInkStdio().stdout,
output: createWorkingStdio().stdout,
terminal: true,
});
+5 -5
View File
@@ -5,7 +5,7 @@
*/
import { describe, it, expect, vi, beforeEach, afterEach } from 'vitest';
import { patchStdio, createInkStdio } from './stdio.js';
import { patchStdio, createWorkingStdio } from './stdio.js';
import { coreEvents } from './events.js';
vi.mock('./events.js', () => ({
@@ -53,14 +53,14 @@ describe('stdio utils', () => {
expect(process.stderr.write).toBe(originalStderrWrite);
});
it('createInkStdio writes to real stdout/stderr bypassing patch', () => {
it('createWorkingStdio writes to real stdout/stderr bypassing patch', () => {
const cleanup = patchStdio();
const { stdout: inkStdout, stderr: inkStderr } = createInkStdio();
const { stdout, stderr } = createWorkingStdio();
inkStdout.write('ink stdout');
stdout.write('working stdout');
expect(coreEvents.emitOutput).not.toHaveBeenCalled();
inkStderr.write('ink stderr');
stderr.write('working stderr');
expect(coreEvents.emitOutput).not.toHaveBeenCalled();
cleanup();
+2 -2
View File
@@ -80,9 +80,9 @@ export function patchStdio(): () => void {
/**
* Creates proxies for process.stdout and process.stderr that use the real write methods
* (writeToStdout and writeToStderr) bypassing any monkey patching.
* This is used by Ink to render to the real output.
* This is used to write to the real output even when stdio is patched.
*/
export function createInkStdio() {
export function createWorkingStdio() {
const inkStdout = new Proxy(process.stdout, {
get(target, prop, receiver) {
if (prop === 'write') {