LinuxQuestions.org
Register a domain and help support LQ
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices

Reply
 
Search this Thread
Old 04-21-2010, 10:30 PM   #1
bharatbsharma
Member
 
Registered: Oct 2007
Posts: 33

Rep: Reputation: 15
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.
 
Old 04-21-2010, 10:52 PM   #2
grail
Guru
 
Registered: Sep 2009
Location: Perth
Distribution: Manjaro
Posts: 7,426

Rep: Reputation: 1876Reputation: 1876Reputation: 1876Reputation: 1876Reputation: 1876Reputation: 1876Reputation: 1876Reputation: 1876Reputation: 1876Reputation: 1876Reputation: 1876
Might need to see a little more code in context otherwise I would just say - "echo should just work"
 
Old 04-21-2010, 11:30 PM   #3
bharatbsharma
Member
 
Registered: Oct 2007
Posts: 33

Original Poster
Rep: Reputation: 15
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
 
Old 04-22-2010, 02:04 AM   #4
grail
Guru
 
Registered: Sep 2009
Location: Perth
Distribution: Manjaro
Posts: 7,426

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


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
expect (Tcl) question kristof_v Programming 2 01-24-2013 05:32 AM
TCL e EXPECT gustavolinux Programming 1 10-17-2008 09:03 AM
Expect interpreter, spawn and cat Ricio Programming 11 08-16-2008 05:55 PM
Unexpected curly braces in expect script spawn command & bash suid problem slinx Programming 1 05-02-2008 01:47 PM
TCL, Expect, for Rsync - Please Help dholingw Programming 2 02-08-2004 10:27 AM


All times are GMT -5. The time now is 05:50 PM.

Main Menu
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration