|
@@ -27,8 +27,8 @@ function detectShellPath() {
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
- // Ultimate fallback: use /bin/sh
|
|
|
|
|
- return '/bin/sh';
|
|
|
|
|
|
|
+ // Ultimate fallback: use 'bash' without path (let PATH resolve it)
|
|
|
|
|
+ return 'bash';
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
const SHELL_PATH = detectShellPath();
|
|
const SHELL_PATH = detectShellPath();
|
|
@@ -201,12 +201,22 @@ export class CommandExecutor {
|
|
|
logger.info('Executing command', { type, command, args, fullCommand, cwd, timeout });
|
|
logger.info('Executing command', { type, command, args, fullCommand, cwd, timeout });
|
|
|
|
|
|
|
|
try {
|
|
try {
|
|
|
- const { stdout, stderr } = await execAsync(fullCommand, {
|
|
|
|
|
|
|
+ // Use default shell if SHELL_PATH is just 'bash' (more compatible with restricted environments)
|
|
|
|
|
+ const execOptions = {
|
|
|
timeout,
|
|
timeout,
|
|
|
cwd: cwd || process.cwd(),
|
|
cwd: cwd || process.cwd(),
|
|
|
- shell: SHELL_PATH,
|
|
|
|
|
maxBuffer: 10 * 1024 * 1024 // 10MB
|
|
maxBuffer: 10 * 1024 * 1024 // 10MB
|
|
|
- });
|
|
|
|
|
|
|
+ };
|
|
|
|
|
+
|
|
|
|
|
+ // Only set custom shell if we have a full path
|
|
|
|
|
+ if (SHELL_PATH.startsWith('/')) {
|
|
|
|
|
+ execOptions.shell = SHELL_PATH;
|
|
|
|
|
+ } else {
|
|
|
|
|
+ // Let Node.js use default shell resolution
|
|
|
|
|
+ execOptions.shell = true;
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ const { stdout, stderr } = await execAsync(fullCommand, execOptions);
|
|
|
|
|
|
|
|
if (stdout) {
|
|
if (stdout) {
|
|
|
logger.info('Command output (stdout)');
|
|
logger.info('Command output (stdout)');
|