Expect question: interact -reset doesn't always seem to 
Author Message
 Expect question: interact -reset doesn't always seem to

Basically what I'm working on is an augmented ftp program -- Expect
looks for the user to type a few specific things, but everything else
gets passed to the ftp process.  I based this on the badcmd1 example
from the Monkey book.  The question is, what would cause the following
to put the user's input into raw mode the first time through?

global spawn_id ;# ftp already spawned, logged in, etc.

set ftp_prompt "\r\nftp> "
while 1 {
  interact -o -reset -nobuffer -re $ftp_prompt {
    expect_user {
      -re "(\n)?[set bk](quit|exit)[set bk]\n" { break }
      -re "(\n)?[set bk]help[set bk]\n" { show_my_help ; send "help\r" }
      default { exp_continue }


# bk == "\[\t ]*"

The actual code's at work, I'm not, so I didn't type in all of it.
The embarassing part is that this was working until I showed it to my
boss, and then it didn't go into cooked mode until the second time
through the loop.  Any ideas what could cause this?  There are no
other interact statements in the program.

- Eric

Sat, 21 Aug 1999 03:00:00 GMT  
 Expect question: interact -reset doesn't always seem to

[once is enough... to sum up, I had trouble getting interact to work
the first time through]

Here's what the problem was.

The flow of code was:

expect -re $my_ftp_prompt
interact -o -reset -nobuffer -re $my_ftp_prompt {
... ;# rules don't matter here


I guess the -reset doesn't take effect until it can match the prompt,
which takes an iteration.

- Eric

Sat, 21 Aug 1999 03:00:00 GMT  
 [ 2 post ] 

 Relevant Pages 

1. expect's full_buffer doesn't seem to work

2. interact -reset flag in expect fails

3. Using 'interact' inside an expect script

4. using 'interact' in Expect

5. Expect buffering question / dtterm interact question

6. set VIDEO_MODE_RESTRICTION=CGA doesn't seem to work

7. ios.gets doesn't seem to work as advertised

8. setting LD_LIBRARY_PATH doesn't seem to work?

9. require doesn't seem to search $: on Win2K

10. proc doesn't seem to work in NASM

11. Micro Focus CALL-CONVENTION 8 doesn't seem to work

12. Adagide install doesn't seem to work?


Powered by phpBB® Forum Software