pxssh submit su commands = very very slow

Grant Edwards grante at visi.com
Sat Jun 28 20:53:24 EDT 2008


On 2008-06-28, Neil Hodgson <nyamatongwe+thunder at gmail.com> wrote:
> gert:
>> This works but after the su command you have to wait like 2 minutes
>> before each command gets executed ?
>>             s.sendline ('su')
>>             s.expect('Password:')
>
>     A common idiom seems to be to omit the start of the
> expected reply since it may not be grabbed quickly enough.
> Then the prompt has to time out. Try s.expect('assword:')

I don't see why the first letter of the password prompt would
be dropped.  Tty drivers have buffered data for as long as I've
been using Unix (25+ years).  After writing the username you
can wait for an hour before calling read(), and you'll still
see the entire password prompt. I always assumed it was done
that way so the script would work for either "password:" or
"Password:".

-- 
Grant Edwards                   grante             Yow!  Edwin Meese made me
                                  at               wear CORDOVANS!!
                               visi.com            



More information about the Python-list mailing list