For Programmers: Free Programming Magazines  


Home > Archive > Tcl > March 2004 > How do I override/neutralize previous 'expect_before's???









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author How do I override/neutralize previous 'expect_before's???
Martin

2004-03-29, 4:37 pm

expect_before {
-i $id -re $easyToMatch {
puts " AS EXPECTED "
}
}
can easily be switched-off/negated/reversed by doing ...

expect_before -i $id

However, if any_spawn_id is used

expect_before {
-i $any_spawn_id -re $easyToMatch {
puts " AS EXPECTED "
}
then

expect_before -i $any_spawn_id

has no effect! (surely it should behave consistently here?)

I am debugging a test environemnt that is primed using
expect_before in various different places and need to somehow
switch these off. I cannot figure out how to do it
once any_spawn_id creeps in to the equation...
Any help much appreaciated!! thanks

Martin.
Don Libes

2004-03-29, 6:51 pm

mdunford@quarrytech.com (Martin) writes:

> expect_before {
> -i $id -re $easyToMatch {
> puts " AS EXPECTED "
> }
> }
> can easily be switched-off/negated/reversed by doing ...
>
> expect_before -i $id
>
> However, if any_spawn_id is used
>
> expect_before {
> -i $any_spawn_id -re $easyToMatch {
> puts " AS EXPECTED "
> }
> then
>
> expect_before -i $any_spawn_id
>
> has no effect! (surely it should behave consistently here?)
>
> I am debugging a test environemnt that is primed using
> expect_before in various different places and need to somehow
> switch these off. I cannot figure out how to do it
> once any_spawn_id creeps in to the equation...
> Any help much appreaciated!! thanks
>
> Martin.


Works fine for me. Here's the script I tried followed by output I
got:
############################## Here's the script:

spawn telnet

exp_internal 1

expect_before {
-i $any_spawn_id junk {
puts " AS EXPECTED "
}
}

set timeout 2
expect before
expect_before -i $any_spawn_id
expect after

############################## Here's the output:

% expect /tmp/foo
spawn telnet

expect: does "" (spawn_id exp4) match glob pattern "junk"? no
"before"? no
telnet>
expect: does "telnet> " (spawn_id exp4) match glob pattern "junk"? no
"before"? no
expect: timed out

expect: does "telnet> " (spawn_id exp4) match glob pattern "after"? no
expect: timed out
%
Sponsored Links







Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive

Copyright 2008 codecomments.com