Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

Re: zpty woes



Stephane Chazelas wrote:
> On Thu, May 15, 2008 at 02:18:57PM +0100, Peter Stephenson wrote:
> > Jaime Vargas wrote:
> > > In the script attached, when trying to follwing line always fails.
> > > 
> > >      zpty -r scppty line "*:" || echo "no password asked" && exit
> > > 
> > > It appears that the "password" string from the ssh session is discarded
> > > by the psuedo terminal.
> > > 
> > > Is there a way to fix this? or Am I missing something?
> > 
> > To work around this, you need to use non-blocking mode, i.e. start with
> > "zpty -b scppty ...".
> 
> It works for me without "-b", why would you say "-b" is
> necessary?

OK, it works without -b if and only if you have the pattern.  That
stops it needing the newline.  I said the code was tortuous.

> The problem I've found is that zpty -r doesn't return when the
> command in the pty has terminated. A strace -p shows:
> 
> read(12, 0xb7ba04c8, 1)                 = -1 EIO (Input/output error)

Highly plausible.  That's likely to be the loop where it waits for the
pattern regardless.

-- 
Peter Stephenson <pws@xxxxxxx>                  Software Engineer
CSR PLC, Churchill House, Cambridge Business Park, Cowley Road
Cambridge, CB4 0WZ, UK                          Tel: +44 (0)1223 692070



Messages sorted by: Reverse Date, Date, Thread, Author