On 25.12.2006, at 12:01, Zoran Vasiljevic wrote:
The only chance is to artificially plumb the channel structure and remove (or redefine) closeproc elements for std channels.
Actually, it is enough to do two things: 1. In generic/tclIO.c:Tcl_GetStdChannel() avoid artificial dump of channel to prevent its closing (comment-out the Tcl_RegisterChannel() call) 2. In unix/tclUnixChan:TclpGetDefaultStdChannel() make dup(0|1|2) correspondigly instead of opening the file channel on the original descriptor. I will approach Tcl core (actually Andreas) and discuss this with him and perhaps raise this issue on Tcl core list. I have tested it on Unix and this works. I believe some kind of "duplicate channel handle" is available on Windows as well. It will most probably be fixed in core-8-4-branch and head branch some time in early January 2007. Until then, at least you know why your (otherwise leak-free) code leaks in NS.