-
Notifications
You must be signed in to change notification settings - Fork 689
Closed
Description
Problem
When using kamal app exec with the --quiet flag to redirect binary output (like tar archives), the command still outputs an "App Host:" prefix line that corrupts the binary stream.
Example Use Case
Attempting to backup application storage by creating a tar archive and streaming it locally:
bundle exec kamal app exec --quiet --reuse -- "tar czf - /rails/storage/" > backup.tar.gzExpected Result: A valid gzip-compressed tar archive
Actual Result: Corrupted file that starts with ASCII text "App Host: hostname\n" followed by the gzip data
Root Cause
In lib/kamal/sshkit_with_ext.rb:21-23:
def puts_by_host(host, output, type: "App")
puts "#{type} Host: #{host}\n#{output}\n\n"
endThis method always outputs the prefix regardless of the verbosity setting. While --quiet sets commander.verbosity = :error, puts_by_host doesn't check this setting before outputting.
The method is called from lib/kamal/cli/app.rb:151 and lib/kamal/cli/app.rb:167:
puts_by_host host, capture_with_info(*KAMAL.app(role: role, host: host).execute_in_existing_container(cmd, env: env))Environment
- Kamal version: 2.x
- Ruby version: 3.4.5
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels