LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Programming (http://www.linuxquestions.org/questions/programming-9/)
-   -   send: spawn id exp1025 not open in tcl/expect (http://www.linuxquestions.org/questions/programming-9/send-spawn-id-exp1025-not-open-in-tcl-expect-803428/)

bharatbsharma 04-21-2010 11:30 PM

send: spawn id exp1025 not open in tcl/expect
 
Hello

my tcl framework give exception - send: spawn id exp1025 not open - while executing command - exp_send "echo $ABC". Though this is very sporadic in nature and frequency of occurrence is very less, but still i need to fix it.

I have following queries

- why does this occur so sporadically?
- how do i fix it?
- what shall i do to avoid such exceptions in future.

Note : The function which runs the exp_send command always spawn a bash whenever it is called.

grail 04-21-2010 11:52 PM

Might need to see a little more code in context otherwise I would just say - "echo should just work"

bharatbsharma 04-22-2010 12:30 AM

Before starting my framework i set env variable in wrapper shell script.
export ABC=something.

when framework is called it calls function run_tc for every test case execution.
proc run_tc {
set A(prompt) "(%|>|#|\\\$) $"
spawn bash
expect -re $A(prompt)
exp_send "echo \$ABC\r"
expect -re $A(prompt)

set tb $expect_out(buffer)
if { [string match "*something*" $tb] } {
# call A

} else {
#call B

}

}

This framework is running for more than 10 hours. But at some point of time, sporadically, exception mentioned below is thrown and execution exits.
shall i run it in catch command and display message error for debugging?
catch { [] } catch_err

grail 04-22-2010 03:04 AM

Quote:

shall i run it in catch command and display message error for debugging?
catch { [] } catch_err
Sounds like a plan :)


All times are GMT -5. The time now is 04:27 PM.