I'm using Tcl_SetStdChannel to redirect all output from my program+script to an external file. I noticed that some output of 'puts' is not being redirected. I'm not able to make a reduced test that covers both situations I see in my bigger program. Here is one that I was able to make that illustrates one of them.
In this reduced test: the command 'puts stdout <string>' gets redirected, but if I leave out 'stdout', it doesn't. However, in my real program I get a situation wherein redirection doesn't work even after explicitly specifying 'stdout'.
Having looked at the code, it seems like there are a couple of ways by which a string like 'stdout' is converted into a channel handle. These don't seem to be respecting Tcl_SetStdChannel. For the case where even specifying 'stdout' doesn't result in redirection in my real test, I noticed that the code satisfies test 'objPtr->typePtr == &tclChannelType' in SetChannelFromAny (tclIO.c).
Am I doing something wrong?