From 2d0f90282bc7668555e9cca8604fcebd13920179 Mon Sep 17 00:00:00 2001 From: 1anZhang <512224856@qq.com> Date: Wed, 4 Nov 2026 15:23:46 +0800 Subject: [PATCH] test(agent-tools): let the failing bash child flush its output process.exit() drops stdout still queued on a POSIX pipe, so the 400-row assertion failed intermittently on Linux runners. Setting process.exitCode keeps the non-zero exit and lets Node flush before exiting. --- packages/agent-tools/test/desktop/ptc-child-uncapped.test.ts | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/packages/agent-tools/test/desktop/ptc-child-uncapped.test.ts b/packages/agent-tools/test/desktop/ptc-child-uncapped.test.ts index aab80a839..a83f5115b 100644 --- a/packages/agent-tools/test/desktop/ptc-child-uncapped.test.ts +++ b/packages/agent-tools/test/desktop/ptc-child-uncapped.test.ts @@ -283,8 +283,10 @@ describe('bash child calls', () => { it('keeps the status line after the whole output of a failing command', async () => { const tool = new LocalBashTool(workspace, undefined, { mode: 'off' }); + // process.exit() would drop stdout still queued on the POSIX pipe, so the + // child sets exitCode and lets Node flush the 400 rows before exiting. const command = nodeCommand( - `for(let i=0;i<400;i++) console.log('row-'+i+'-'+'x'.repeat(90)); process.exit(3)`, + `for(let i=0;i<400;i++) console.log('row-'+i+'-'+'x'.repeat(90)); process.exitCode = 3`, ); const result = await tool.execute(CHILD, { command });