fix exit code for shell tool (#465)

This commit is contained in:
Olcan 2025-05-21 08:51:22 -07:00 committed by GitHub
parent e30dc716b4
commit c9de822930
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 1 additions and 1 deletions

View File

@ -141,7 +141,7 @@ export class ShellTool extends BaseTool<ShellToolParams, ToolResult> {
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], {