title: Handle exit command executed by embedded Tcl runtime
body: <p>I have a small shell application that embeds <a href="http://tmml.sourceforge.net/doc/tcl/category-index.html" rel="noreferrer">Tcl</a> to execute some set of Tcl code. The Tcl interpreter is initialized using Tcl_CreateInterp. Everything is very simple: </p>
  
  <ol>
  <li>user types Tcl command</li>
  <li>the command gets passed to Tcl_Eval for evaluation</li>
  <li>repeat</li>
  </ol>
  
  <p>But if a user types 'exit', which is a valid Tcl command, the whole thing - Tcl interpreter and my shell application - exit automatically.</p>
  
  <p>Q: is there any way I can catch this exit signal coming from Tcl interpreter. I really would like not to check every user command. I tried <a href="http://tmml.sourceforge.net/doc/tcl/CExit.html" rel="noreferrer">Tcl_CreateExitHandler</a>, but it didn't work.</p>
  
  <p>Thanks so much.</p>