On Tue, Nov 30, 2010 at 7:07 PM, Eric C. <beagle4321_2000 / yahoo.com> wrote:
> 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|
> =A0stdout.write("#{pass}\n")
> =A0puts stdin.read.lstrip =A0#write output to screen
> end
>
> This works fine if the password is correct. =A0However, if the password i=
s
> not correct it hangs. =A0I've tried this line too:
>
> =A0stdout.write("#{pass}\n\n\n\n\n\n")
>
> to try to get it to terminate, but it still hangs. =A0Is there a way to
> enter passwords into the command line or enter them ahead of time?
>
> Thanks,
> Eric

sudo -v will prompt the user for the password ahead of time.