diff --git a/CHANGELOG b/CHANGELOG index 54025188..ecb6b00b 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -1,3 +1,7 @@ +*SVN* + +* Added :as option to sudo, so you can specify who the command is executed as [Mark Imbriaco] + *1.2.0* (September 14, 2006) * Add experimental 'shell' task [Jamis Buck] diff --git a/lib/capistrano/actor.rb b/lib/capistrano/actor.rb index d1f503de..c6b6df33 100644 --- a/lib/capistrano/actor.rb +++ b/lib/capistrano/actor.rb @@ -277,9 +277,10 @@ module Capistrano # in order to prevent _each host_ from prompting when the password was # wrong, let's track which host prompted first and only allow subsequent # prompts from that host. - prompt_host = nil + prompt_host = nil + user = options[:as].nil? ? '' : "-u #{options[:as]}" - run "#{sudo_command} #{command}", options do |ch, stream, out| + run "#{sudo_command} #{user} #{command}", options do |ch, stream, out| if out =~ /^Password:/ ch.send_data "#{password}\n" elsif out =~ /try again/