fix exit code for shell tool (#465)
This commit is contained in:
parent
e30dc716b4
commit
c9de822930
|
@ -141,7 +141,7 @@ export class ShellTool extends BaseTool<ShellToolParams, ToolResult> {
|
||||||
let command = params.command.trim();
|
let command = params.command.trim();
|
||||||
if (!command.endsWith('&')) command += ';';
|
if (!command.endsWith('&')) command += ';';
|
||||||
// note the final echo is only to trigger the stderr handler below
|
// 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)
|
// spawn command in specified directory (or project root if not specified)
|
||||||
const shell = spawn('bash', ['-c', command], {
|
const shell = spawn('bash', ['-c', command], {
|
||||||
|
|
Loading…
Reference in New Issue