From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 12061 invoked from network); 15 May 2008 17:03:28 -0000 X-Spam-Checker-Version: SpamAssassin 3.2.4 (2008-01-01) on f.primenet.com.au X-Spam-Level: X-Spam-Status: No, score=-2.2 required=5.0 tests=AWL,BAYES_00, MSGID_FROM_MTA_HEADER autolearn=no version=3.2.4 Received: from news.dotsrc.org (HELO a.mx.sunsite.dk) (130.225.247.88) by ns1.primenet.com.au with SMTP; 15 May 2008 17:03:28 -0000 Received-SPF: none (ns1.primenet.com.au: domain at sunsite.dk does not designate permitted sender hosts) Received: (qmail 10063 invoked from network); 15 May 2008 17:03:22 -0000 Received: from sunsite.dk (130.225.247.90) by a.mx.sunsite.dk with SMTP; 15 May 2008 17:03:22 -0000 Received: (qmail 6750 invoked by alias); 15 May 2008 17:03:17 -0000 Mailing-List: contact zsh-workers-help@sunsite.dk; run by ezmlm Precedence: bulk X-No-Archive: yes X-Seq: 25045 Received: (qmail 6739 invoked from network); 15 May 2008 17:03:16 -0000 Received: from bifrost.dotsrc.org (130.225.254.106) by sunsite.dk with SMTP; 15 May 2008 17:03:16 -0000 Received: from mail.o2.co.uk (jabba.london.02.net [82.132.130.169]) by bifrost.dotsrc.org (Postfix) with ESMTP id AB97B80589A4 for ; Thu, 15 May 2008 19:03:13 +0200 (CEST) Received: from sc.homeunix.net (78.105.216.138) by mail.o2.co.uk (8.0.013.3) (authenticated as stephane.chazelas) id 480CEB80051F27AE for zsh-workers@sunsite.dk; Thu, 15 May 2008 18:03:12 +0100 Date: Thu, 15 May 2008 18:03:12 +0100 (added by '') Message-ID: <480CEB80051F27AE@> (added by '') Received: from chazelas by sc.homeunix.net with local (Exim 4.69) (envelope-from ) id 1JwgrI-0002jy-H3 for zsh-workers@sunsite.dk; Thu, 15 May 2008 18:03:12 +0100 Resent-From: Stephane Chazelas Resent-Date: Thu, 15 May 2008 18:03:12 +0100 Resent-Message-ID: <20080515170312.GE5190@sc.homeunix.net> Resent-To: Zsh hackers list From: Stephane Chazelas To: Jaime Vargas Cc: Zsh hackers list Subject: Re: zpty woes References: <34AE8142-F5DA-44FD-96BA-61BDE12BC74E@mac.com> <200805151318.m4FDIvKS015244@news01.csr.com> <20080515145054.GC5190@sc.homeunix.net> <99E8D43E-EC34-48DB-A5AD-BFA197A3AAA3@mac.com> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-15 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <99E8D43E-EC34-48DB-A5AD-BFA197A3AAA3@mac.com> User-Agent: Mutt/1.5.16 (2007-09-19) X-Mutt-Fcc: =outbox X-Virus-Scanned: ClamAV 0.91.2/7129/Thu May 15 18:00:53 2008 on bifrost X-Virus-Status: Clean On Thu, May 15, 2008 at 12:00:25PM -0400, Jaime Vargas wrote: > Still doesn't work for me. Below is the modified script and the debug > output. > > #!/opt/csw/bin/zsh > > set -x > > zmodload zsh/zpty > > die() {print -r -- $1 >&2; exit 1;} > > zpty scppty scp hello.world jvargas@aoma6000-4-9.aoma.rhbss.com:~/ > zpty -t scppty || die "fuck" > zpty -r scppty line "*:" || die "no password asked" > zpty -w scppty "3lp&tbw" > while zpty -r scppty line; > do > result+="$line"$'\n' > done > zpty -d scppty > print $result > > I changed my credentials for security. Basically it now hangs waitng for > password and doesnt' do anything. -- Jaime > > nerd% ./zpty-test.zsh > +./zpty-test.zsh:5> zmodload zsh/zpty > +./zpty-test.zsh:10> zpty scppty scp hello.world 'luser@host:~/' > +./zpty-test.zsh:11> zpty -t scppty > +./zpty-test.zsh:12> zpty -r scppty line '*:' Had you printed $line, you'd have seen something like "+myscript:", not "Passwd: ". [...] > +./zpty-test.zsh:14> zpty -r scppty line [...] As Peter said, if you don't provide with a pattern to look for, zpty will look for NL characters. That last zpty is probably still waiting because so far, it has only received "Password: " and is waiting for a NL character that will never come. So, in your code above, you should wait for something more specific than just ":": zpty -r scppty line "assword: " || die "no password asked" for instance. -- Stéphane