Ruby PTY.spawn is Hanging - How to fill out Email and Password in simple example
Posted
by viatropos
on Stack Overflow
See other posts from Stack Overflow
or by viatropos
Published on 2010-04-11T22:01:45Z
Indexed on
2010/04/11
22:03 UTC
Read the original article
Hit count: 348
After asking this question, it looks like I need to use Ruby's PTY Module, of which there is no documentation.
I have written this code to try to push content to Google App Engine because the python command sometimes asks me for my username and password. But when I run this code, it just hangs.
cmd = "appcfg.py update cdn"
PTY.spawn("#{cmd} 2>&1") do | input, output, pid |
begin
input.expect("Email:") do
output.write("#{credentials[:username]}\n")
end
input.expect("Password:") do
output.write("#{credentials[:password]}\n")
end
rescue Exception => e
puts "GAE Error..."
end
end
What am I missing here? How can I get this to work?
© Stack Overflow or respective owner