Tcl Source Code

View Ticket
Login
Ticket UUID: 5338d8e82fb3e23658b61bb60ea82cdd2d581c61
Title: Closing the std* channels and opening replacements sometimes doesn't register the std* channel name in interps
Type: Bug Created on: 2023-05-04 13:02:25
Submitter: cyan Assigned to: nobody
Subsystem: 25. Channel System Severity: Minor
Priority: 5 Medium Last modified: 2023-05-04 13:04:21
Status: Open Closed by: nobody
Resolution: None Closed on:
Version: 8.7a6
Description:
In the following code, if stdout was written to by the parent interp before closing
then it will fail on the line that configures the (new) stdout channel with the error:

can not find channel named "stdout"

If the first line that outputs to stdout in the parent interp is commented out, the code
works as expected:

interp create foo
puts "before, parent"   ;# Works if this line is commented out
interp eval foo {puts stderr "before, child"}
interp eval foo {close stdout}
interp eval foo [list open [exec tty] w]
interp eval foo {chan configure stdout -buffering line -blocking 0}
puts "New stdout, from parent"
interp eval foo {puts "New stdout, from child"}