int main() {
Tcl_Interp *interp = Tcl_CreateInterp();
Tcl_Eval(interp, "close stdout");
Tcl_Eval(interp, "puts hello");
std::cout << "other output" << std::endl;
}
I have a program which uses Tcl_Interpreter
. I don't want to see its output in stdout, so I am closing it. But it closes stdout of whole program and "other output"
is not displayed too. My program could have lots of other outputs. Why Tcl interpreter disables it.
This kind of situation is when I am trying to evaluate exit
command in interpreter. I expect that it should only destroy, delete or disable the interpreter, but it is calling std::exit
which closes whole program, which retains undestructed objects.
I know that there may be workarounds to this situations but I am curios why does Tcl Interpreter implemented in such way. It would be more useful that it changes only itself, not the whole program.