소스 검색

fix: preserve empty arguments in command execution (#4)

Empty arguments were being lost during command string building, causing
positional parameter misalignment in shell scripts. For example, when
COMMENT_BODY was empty, the assignee value ended up in the wrong position.

Changes:
- Modified buildCommandString to wrap empty strings in quotes ('')
- Ensures bash correctly receives all positional parameters
- Prevents argument position shifting when empty values are present

Example fix:
Before: script.sh arg1 assigned  claude (only 8 args, double space)
After:  script.sh arg1 assigned '' claude (9 args, empty preserved)

Fixes #4

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
Claude 9 달 전
부모
커밋
467952ed68
1개의 변경된 파일4개의 추가작업 그리고 0개의 파일을 삭제
  1. 4 0
      src/commandExecutor.js

+ 4 - 0
src/commandExecutor.js

@@ -162,6 +162,10 @@ export class CommandExecutor {
   buildCommandString(command, args = []) {
     // Escape arguments for shell execution
     const escapeArg = (arg) => {
+      // Always wrap empty strings in quotes to preserve them as arguments
+      if (arg === '') {
+        return "''";
+      }
       // If arg contains spaces or special chars, wrap in single quotes
       if (arg.includes(' ') || arg.includes('$') || arg.includes('`') || arg.includes('"')) {
         return `'${arg.replace(/'/g, "'\\''")}'`;