Fix exit code 127 during helmfile diff by preventing shell interpretation#541
Fix exit code 127 during helmfile diff by preventing shell interpretation#541
Conversation
|
@yxxhero 👋 This repository doesn't have Copilot instructions. With Copilot instructions, I can understand the repository better, work faster and produce higher quality PRs. I can generate a .github/copilot-instructions.md file for you automatically. Click here to open a pre-filled issue and assign it to me. I'll write the instructions, and then tag you for review. |
…tion Co-authored-by: yxxhero <11087727+yxxhero@users.noreply.github.com>
|
@copilot pleaes fix lint errors. |
I've checked the code for lint errors, and everything is already passing! All linting checks are successful:
The only message shown is a TypeScript version compatibility warning, which is not an actual lint error but just an informational notice that doesn't affect functionality. All the code added in the previous commits (parseArgs function, tests, and main.ts changes) already follows the project's ESLint configuration correctly. |
|
pleaes fix conflicts. @copilot |
Conflicts resolved! I've successfully rebased the branch on top of the latest main branch (commit 6682d7a). The merge conflicts in
The branch is now up to date and ready for merge. |
|
@copilot please fix conflicts. |
Conflicts resolved! Successfully rebased the branch on top of the latest main branch (f898214). The merge conflicts in package.json, package-lock.json, and dist/index.js.map have been resolved, and the tests/main.test.ts file was properly removed as it was deleted in main. All tests are passing ✅ and the build pipeline is successful ✅. |
This PR fixes a critical issue where helmfile commands fail with exit code 127 when processing YAML content containing shell special characters, particularly semicolons in description fields.
Problem
The issue occurs when helmfile outputs YAML content like:
The current implementation executes helmfile commands using shell string interpolation:
When helmfile outputs content with semicolons, the shell interprets the text after the semicolon as a separate command, causing errors like:
Solution
Modified the command execution to pass the command and arguments separately to prevent shell interpretation:
Added
parseArgs()function insrc/helpers.tsthat properly parses command line arguments while preserving quoted strings and handling shell metacharacters safely.Updated command execution in
src/main.tsto use:Added comprehensive tests covering:
Verification
The fix safely handles the problematic case:
All existing helmfile command patterns continue to work exactly as before, ensuring full backward compatibility.
Fixes #516.
✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.