Skip to content
Draft
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion packages/core/src/tools/shell.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ import {
isCommandAllowed,
stripShellWrapper,
} from '../utils/shell-utils.js';
import * as shellQuote from 'shell-quote';

export const OUTPUT_UPDATE_INTERVAL_MS = 1000;

Expand Down Expand Up @@ -205,7 +206,7 @@ export class ShellTool extends BaseTool<ShellToolParams, ToolResult> {
? strippedCommand
: (() => {
// wrap command to append subprocess pids (via pgrep) to temporary file
let command = strippedCommand.trim();
let command = shellQuote.quote([strippedCommand.trim()]);
if (!command.endsWith('&')) command += ';';
return `{ ${command} }; __code=$?; pgrep -g 0 >${tempFilePath} 2>&1; exit $__code;`;
})();
Expand Down
Loading