Ruby PTY.spawn is Hanging - How to fill out Email and Password in simple example
- by viatropos
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?