Quote exec command arguments - #1904
Open
cookesan wants to merge 1 commit into
Open
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
This PR fixes argument quoting for kamal * exec when multiple CLI arguments are collapsed into a single remote shell command string, while preserving the existing behavior for single-string commands (e.g., "ruby -v").
Changes:
- Update
Kamal::Utils.join_commandsto return the original string for single-argument commands and to shell-escape/join multi-argument commands viaShellwords.join. - Add unit coverage for
join_commandsto ensure single-string commands remain unchanged and multi-arg commands preserve spaced arguments. - Add a CLI regression test ensuring
kamal app execkeeps a spaced argument intact in the emitted docker command.
Tip
If you aren't ready for review, convert to a draft PR.
Click "Convert to draft" or run gh pr ready --undo.
Click "Ready for review" or run gh pr ready to reengage.
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
| lib/kamal/utils.rb | Implements Shellwords-based joining for multi-argument exec commands while preserving the single-string path. |
| test/utils_test.rb | Adds focused unit tests for join_commands behavior (single string vs. multiple args). |
| test/cli/app_test.rb | Adds a regression test asserting spaced exec arguments remain intact in output. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Fixes #1651
Testing
bin/test test/utils_test.rb test/cli/app_test.rbbin/test test/utils_test.rb test/cli/app_test.rb test/cli/accessory_test.rb test/cli/server_test.rbbin/test test/commands/app_test.rb test/commands/accessory_test.rb test/utils_test.rbbundle exec rubocop --parallelbin/test(local full-suite run: 857 runs, 3098 assertions, 3 failures, 3 errors; the isolated failures intest/commands/builder_test.rb:271andtest/commands/hook_test.rb:36reproduce on cleanupstream/mainin this environment)