By default, commands executed via 'run' must be non-interactive. If
you want to respond to prompts and such, you need to build that
interaction yourself, by checking the output for the expected prompt,
repeating the prompt locally, and then sending the response to the
server, like this:
run 'passwd', :pty => true do |ch, stream, data|
if data =~ /Enter new UNIX password:/
# prompt, and then send the response to the remote process
ch.send_data(Capistrano::CLI.password_prompt("New password: ")
+ "\n")
else
# use the default handler for all other text
Capistrano::Configuration.default_io_proc.call(ch, stream, data)
end
end
- Jamis
On Jul 2, 2008, at 2:20 AM, remi wrote:
>
> I'm using Capistrano v2.4.3 and if i:
>
> run 'passwd', :pty => true
>
> ... the server never sees what I type and I have to kill the session.
>
> $ cap change_password
> * executing `change_password'
> * executing "passwd"
> servers: ["myserver"]
> Password:
> [myserver] executing command
> ** [out :: myserver] Enter new UNIX password:
> testing123
> testing123
>
> what am I doing wrong?
>
> i've also set default_run_options[:pty] = true
>
> thanks
> >
--~--~---------~--~----~------------~-------~--~----~
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at http://groups.google.com/group/capistrano
-~----------~----~----~----~------~----~------~--~---