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

Added :as option to sudo so you can specify who a command should be executed as

git-svn-id: http://svn.rubyonrails.org/rails/tools/capistrano@5145 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
This commit is contained in:
Jamis Buck 2006-09-18 22:54:47 +00:00
parent 92ef7f5558
commit c2a69316a2
2 changed files with 7 additions and 2 deletions

View file

@ -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]

View file

@ -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/