The public Tk function, Tk_InitConsoleChannels()
has no documentation.
When the documentation is written, it should make
it clear that Tk_InitConsoleChannels() must be called
early in a program -- before any Tcl_Channel operations
have a chance to take place.
Otherwise, the failure of Tk_InitConsoleChannels()
to Tcl_RegisterChannel() the console channels
-- it can't, it has no interp to work with --
and the lack of auto-registration of the Tcl
standard channels to make up for it -- because the
previous Tcl_Channel operations already initialized
the Tcl standard channels to the system defaults --
will cause nasty errors like
"can not find channel named "stderr""
See attached demo.c for explanation of how to
properly use Tcl_SetStdChannel, and why
Tk_InitConsoleChannels() can't do that, so must
be called early instead.
Logged In: YES
user_id=80530
Hmmm.... looking again I see that Tk_InitConsoleChannels
*does* take an interp argument after all, so maybe this
is just a bug? Why doesn't Tk_InitConsoleChannels call
Tcl_RegisterChannel on the channels it creates?
Logged In: YES
user_id=80530
Looks like a side effect of Tcl_RegisterChannel is
to initialize any uninitialized standard channels
with their platform default values. That could
mess up Tk_InitConsoleChannels, so that's probably
why it isn't called.
Logged In: YES
user_id=80530
This is driving me crazy again! I can't get
Tk_InitConsoleChannels() and Tk_CreateConsoleWindow()
to work correctly on Unix!
Anyone know what happened to the demo.c file that was
allegedly attached here?!
Logged In: YES
user_id=80530
AAaaaarrrrrgggggghhhhh!!!!!!
A rebuild and things are working again (sort of).
I hate irreproducible observations...
Logged In: YES
user_id=80530
OK, tracked it down, and my brain is back to the state
it was in when it filed this bug report in the first
place.
If any Tcl routines dealing with Tcl_Channels get called
before Tk_InitConsoleChannels, there will be problems
with writing to stdout and stderr. It's important that if
you are going to call Tk_InitConsoleChannels, that you do
so before anything calls Tcl_RegisterChannel.
...and no, I never found demo.c.
Logged In: YES
user_id=75003
Originator: NO
Added a manpage for the function. Very minimal. Needs review.
Logged In: YES
user_id=79902
Originator: NO
Bugfix:
change \fb to \fB
Improvement:
Add
console(n)
to the "SEE ALSO" section.
(I'd fix myself except for the stupid firewall/proxy I'm behind.)
Logged In: YES
user_id=75003
Originator: NO
Will do.
Logged In: YES
user_id=75003
Originator: NO
And done.