Artifact
07bfce7ee0e09bc90ab928e1c19380802c448c9d58d589903429cf0661d9bf5d:
Attachment "crash3.tcl" to
ticket [ea69b0258a]
added by
petrokaz
2023-03-07 10:31:17.
(unpublished)
package require tcl::transform::observe
proc writable {sock} {
chan event $sock writable {}
chan configure $sock -translation {crlf lf} -blocking 0 -buffering full -encoding binary
chan event $sock readable [list readable $sock]
set ::status "connected"
}
proc readable {sock} {
set readCount [chan gets $sock line]
if {$readCount < 0} {
if {[eof $sock]} {
puts "Connection aborted"
chan event $sock readable {}
set ::msg "closed"
}
return
}
set ::msg $line
}
set sock [socket -async localhost 4400]
chan event $sock writable [list writable $sock]
vwait ::status
puts "Status=$status"
tcl::transform::observe $sock stdout ""
puts -nonewline $sock "Hello1\r\nHello2\r\n"
flush $sock
vwait ::msg
puts "Got $msg"
puts "pending input before pop: [chan pending input $sock]"
chan pop $sock
puts "pending input after pop: [chan pending input $sock]"
after 100 {set ::forever 1}
vwait forever ;# crashes here
close $sock
puts DONE