1
0
Fork 0
mirror of https://github.com/capistrano/capistrano synced 2023-03-27 23:21:18 -04:00

Merge pull request #265 from nutznboltz/issue-251

Can't use sudo as an argument in cap shell command
This commit is contained in:
Lee Hambley 2013-04-02 11:42:50 -07:00
commit 2fe158fc9e

View file

@ -174,7 +174,7 @@ HELP
# Execute a command on the given list of servers. # Execute a command on the given list of servers.
def exec_command(command, servers) def exec_command(command, servers)
command = command.gsub(/\bsudo\b/, "sudo -p '#{configuration.sudo_prompt}'") command = command.gsub(/^(\s*)sudo\b|([|;&])\s*sudo\b/, "\\0 -p '#{configuration.sudo_prompt}'")
processor = configuration.sudo_behavior_callback(Configuration.default_io_proc) processor = configuration.sudo_behavior_callback(Configuration.default_io_proc)
sessions = servers.map { |server| configuration.sessions[server] } sessions = servers.map { |server| configuration.sessions[server] }
options = configuration.add_default_command_options({}) options = configuration.add_default_command_options({})