1 Dec 2010 02:07
Entering password in shell
Eric C. <beagle4321_2000 <at> yahoo.com>
2010-12-01 01:07:26 GMT
2010-12-01 01:07:26 GMT
HI:
I'm trying to run a shell to install a gem:
PTY.spawn("sudo gem install #{gem} --local 2>&1") do |stdin,stdout,pid|
stdout.write("#{pass}\n")
puts stdin.read.lstrip #write output to screen
end
This works fine if the password is correct. However, if the password is
not correct it hangs. I've tried this line too:
stdout.write("#{pass}\n\n\n\n\n\n")
to try to get it to terminate, but it still hangs. Is there a way to
enter passwords into the command line or enter them ahead of time?
Thanks,
Eric
--
--
Posted via http://www.ruby-forum.com/.
RSS Feed