The expect interpreter calls Tcl_Exit function at the end to terminate a
script. Due to this, we cannot do additional cleanup (ie. collect
profiling data and save it in a file) on exit.
Would it be reasonable to ask that the exit functionality of expect be
changed to follow that of the tclsh interpreter?
Here's the relevant code from tclMain.c file that should replace the
Tcl_Exit function call in exp_main_exp.c file:
/* need to declare buffer variable */
* Rather than calling exit, invoke the "exit" command so that
* users can replace "exit" with some other command to do additional
* cleanup on exit. The Tcl_Eval call should never return.
sprintf(buffer, "exit %d", exitCode);
The Tcl_Exit function is invoked in the following files.
godel> fgrep -l Tcl_Exit *.c