I have a small shell application that embeds Tcl to execute some set of Tcl code. The Tcl interpreter is initialized using Tcl_CreateInterp. Everything is very simple:
- user types Tcl command
- the command gets passed to Tcl_Eval for evaluation
- repeat
But if a user types 'exit', which is a valid Tcl command, the whole thing - Tcl interpreter and my shell application - exit automatically.
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 Tcl_CreateExitHandler, but it didn't work.
Thanks so much.
Tcl_CreateExitHandleris for trapping exits and releasing resources (e.g., database connections) that otherwise hang around nastily. It can't stop an exit from happening. - Donal FellowsTcl_CreateExitHandlerwork in this case? - ilya1725