Changeset 7696
- Timestamp:
- 09/30/07 15:23:17 (9 months ago)
- Files:
-
- tools/capistrano/CHANGELOG (modified) (1 diff)
- tools/capistrano/lib/capistrano/configuration/actions/invocation.rb (modified) (1 diff)
- tools/capistrano/lib/capistrano/shell.rb (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
tools/capistrano/CHANGELOG
r7695 r7696 1 1 *SVN* 2 3 * Fix cap shell to properly recognize sudo prompt [Mark Imbriaco, barnaby, Jamis Buck] 2 4 3 5 * Git SCM module [Garry Dolley, Geoffrey Grosenbach, Scott Chacon] tools/capistrano/lib/capistrano/configuration/actions/invocation.rb
r7392 r7696 125 125 end 126 126 127 private 128 129 # Returns the prompt text to use with sudo 130 def sudo_prompt 131 fetch(:sudo_prompt, "sudo password: ") 132 end 127 # Returns the prompt text to use with sudo 128 def sudo_prompt 129 fetch(:sudo_prompt, "sudo password: ") 130 end 133 131 end 134 132 end tools/capistrano/lib/capistrano/shell.rb
r7205 r7696 167 167 # Execute a command on the given list of servers. 168 168 def exec_command(command, servers) 169 processor = Proc.new do |ch, stream, out| 170 # TODO: more robust prompt detection 171 out.each do |line| 172 if stream == :out 173 if out =~ /Password:\s*/i 174 ch.send_data "#{configuration[:password]}\n" 175 else 176 puts "[#{ch[:server]}] #{line.chomp}" 177 end 178 elsif stream == :err 179 puts "[#{ch[:server]} ERR] #{line.chomp}" 180 end 181 end 182 end 183 169 command = command.gsub(/\bsudo\b/, "sudo -p '#{configuration.sudo_prompt}'") 170 processor = configuration.sudo_behavior_callback(Configuration.default_io_proc) 171 sessions = servers.map { |server| configuration.sessions[server] } 172 cmd = Command.new(command, sessions, :logger => configuration.logger, &processor) 184 173 previous = trap("INT") { cmd.stop! } 185 sessions = servers.map { |server| configuration.sessions[server] } 186 Command.process(command, sessions, :logger => configuration.logger, &Capistrano::Configuration.default_io_proc) 174 cmd.process! 187 175 rescue Capistrano::Error => error 188 176 warn "error: #{error.message}"