Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bug: CommandMap prefix ignores override #299

Closed
sbonami opened this issue Nov 8, 2015 · 2 comments
Closed

Bug: CommandMap prefix ignores override #299

sbonami opened this issue Nov 8, 2015 · 2 comments

Comments

@sbonami
Copy link

sbonami commented Nov 8, 2015

When defining a command_map override, output matches intended functionality:

SSHKit.config.command_map[:rake] = 'pitch_fork'
SSHKit.config.command_map[:rake] => 'pitch_fork'

However, when a prefix for the command exists, the original command is served with the prefix rather than the override:

SSHKit.config.command_map[:rake] = 'pitch_fork'
SSHKit.config.command_map[:rake].push("bundle exec")
SSHKit.config.command_map[:rake] => 'bundle exec rake'

I would figure we'd get this:

SSHKit.config.command_map[:rake] = 'pitch_fork'
SSHKit.config.command_map[:rake].push("bundle exec")
SSHKit.config.command_map[:rake] => `bundle exec pitch_fork`

Should L45 be something like this?:

"#{prefixes} #{@map[command] || command}"

Related source: https://github.com/capistrano/sshkit/blob/master/lib/sshkit/command_map.rb#L42-L45

@dgtized
Copy link

dgtized commented Dec 1, 2015

👍 I also encountered this. Unfortunately changing the code the way you suggest breaks the existing tests, which suggests that someone may be using the existing defaults logic.

I was trying to use it to swap out rake to always run a command before the generated command. Example:

SSHKit.config.command_map[:rake] = "rake stdout_logging"
execute :rake, "foo"
# expecting that to run
# => bundle exec rake stdout_logging foo
# but instead it runs
# => bundle exec /usr/bin/env rake foo

@mattbrictson
Copy link
Member

It looks like this issue might be addressed in PR #311.

@leehambley leehambley changed the title CommandMap prefix ignores override Bug: CommandMap prefix ignores override Feb 21, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants