Hello,
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[1000] 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);
Tcl_Eval(interp, buffer);
The Tcl_Exit function is invoked in the following files.
godel> fgrep -l Tcl_Exit *.c
exp_command.c
exp_main_exp.c
exp_main_sub.c
exp_main_tk.c
exp_tty.c
Change, v0
Logged In: YES
user_id=75003
Added a patch performing the requested change.
Note that we must not change "exp_command.c".
Here "exp_exit" is implemented and calling "exit"
inside of that will result in an infinite recursion.
Logged In: YES
user_id=75003
This patch was committed to "expect-sf418892-sf439042-
branch".
Logged In: YES
user_id=75003
Merged to head.