Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

exec output problem

Status
Not open for further replies.

notmeatleast

Programmer
May 25, 2004
8
FR
Hi guys,
Suppose a.tcl contains
puts "Hi"

and b.tcl contains
exec tclsh a.tcl

Now, when I run tclsh b.tcl, it just retruns to the % prompt without giving any output. Why's that? How can I achive that. I don't want to use source command, as I'll have a different interpreter than the one I'm running in.

Thanks in advance.
 
because exec "create" another process. and the stdout (for the puts) is in this new process.
because it is quite fast it dies instantly and you do not see anything.

try this in your b.tcl
Code:
source a.tcl

a try to avoid exec as much as you can.
if you need to run several task recompile Tcl/Tk to make it thread safe.
and then use the Tclthread extension.


 
Or if you are on unix use fork() anmd tclX. ;)
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top