Mailing List Archive
tlug.jp Mailing List tlug archive tlug Mailing List Archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]Re: [tlug] Expect: looping until there is no more input from spawn
- Date: Tue, 11 Mar 2008 15:08:52 +0900
- From: Edward Wright <edw@example.com>
- Subject: Re: [tlug] Expect: looping until there is no more input from spawn
- References: <d8fcc0800803102000r786e54d0k1dd2c5bb52271da6@mail.gmail.com>
- User-agent: Mutt/1.5.13 (2006-08-11)
On Tue, Mar 11, 2008 at 12:00:50PM +0900, Josh Glover wrote: > Any expect(1) users on this list? > > I have a simple script to automate resolving integrations with Perforce: > > > #!/usr/bin/expect -f > > set timeout 30 > > spawn p4 resolve > while {1} { > expect { > "Accept(a) Edit(e) Diff(d) Merge (m) Skip(s) Help(?)" { > send "at\r" > } "This overrides your changes: confirm accept (y/n)?" { > send "y\r" > } > } > } > > > This works fine, but when the "p4 resolve" command finishes, my Expect > script spews the following error: > Caveat: I don't know Perforce and I'm not an Expect expert. Does Perforce return anything when it's done? If not, presumably there's an eof? Idea #1: use "system" instead of "spawn" and test for the return value in the condition Idea #2: Use a conditional expect and test for the return value (or eof) in the loop, and if so, break out: expect { eof { break } your stuff } Ed
- Follow-Ups:
- Re: [tlug] Expect: looping until there is no more input from spawn
- From: Josh Glover
- References:
- [tlug] Expect: looping until there is no more input from spawn
- From: Josh Glover
Home | Main Index | Thread Index
- Prev by Date: Re: [tlug] Apache MPM performance
- Next by Date: Re: [tlug] Apache MPM performance
- Previous by thread: [tlug] Expect: looping until there is no more input from spawn
- Next by thread: Re: [tlug] Expect: looping until there is no more input from spawn
- Index(es):
Home Page Mailing List Linux and Japan TLUG Members Links