From c9de822930dff0a4bbd3ee5e13023b54dc0222c3 Mon Sep 17 00:00:00 2001 From: Olcan Date: Wed, 21 May 2025 08:51:22 -0700 Subject: [PATCH] fix exit code for shell tool (#465) --- packages/server/src/tools/shell.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/server/src/tools/shell.ts b/packages/server/src/tools/shell.ts index 73f54b44..e130fb04 100644 --- a/packages/server/src/tools/shell.ts +++ b/packages/server/src/tools/shell.ts @@ -141,7 +141,7 @@ export class ShellTool extends BaseTool { let command = params.command.trim(); if (!command.endsWith('&')) command += ';'; // note the final echo is only to trigger the stderr handler below - command = `{ ${command} }; pgrep -g 0 >${tempFilePath} 2>&1; ( trap '' PIPE ; echo >&2 )`; + command = `{ ${command} }; __code=$?; pgrep -g 0 >${tempFilePath} 2>&1; ( trap '' PIPE ; echo >&2 ); exit $__code;`; // spawn command in specified directory (or project root if not specified) const shell = spawn('bash', ['-c', command], {