Skip to content

Bug: CommandMap prefix ignores override #299

Closed

Description

@sbonami

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

Activity

  1. dgtized commented on Dec 1, 2015

    @dgtized

    👍 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
    
  2. mattbrictson commented on Dec 30, 2015

    @mattbrictson
    Member

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

  3. changed the title [-]CommandMap prefix ignores override[/-] [+]Bug: CommandMap prefix ignores override[/+] on Feb 21, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions