Ticket UUID: | 864a0c83e3d03678765c49246bdac961dd337670 | |||
Title: | memchan stops generating read events when cursor is at end of file | |||
Type: | Bug | Version: | 1.15 | |
Submitter: | pooryorick | Created on: | 2013-11-21 21:23:55 | |
Subsystem: | tcl :: chan :: * | Assigned To: | aku | |
Priority: | 5 Medium | Severity: | Important | |
Status: | Closed | Last Modified: | 2013-11-22 18:20:05 | |
Resolution: | Fixed | Closed By: | aku | |
Closed on: | 2013-11-22 18:20:05 | |||
Description: |
In the following script, [copied] never runs, and the script never completes. The reason is the [::tcl::chan::memchan::implementation Events] disallows reads when the cursor is at the end of the file, so [fcopy] never gets the readable file event it is waiting for to get the empty string upon reading and check [eof]. Commenting out the line in Events that disallows "read" fixes the problem in this case. ---- begin code ---- #! /bin/env tclsh package require tcl::chan::events package require tcl::chan::memchan proc copied {args} { puts $args set ::done 1 } set chan [tcl::chan::memchan] puts -nonewline $chan [string repeat a 50000] seek $chan 0 start set chanout [open zout w] fcopy $chan $chanout -command copied vwait ::done | |||
User Comments: |
aku added on 2013-11-22 18:20:05:
Confirmed. This is like with regular files which also fire readable events when at eof, until the handler script deigns to handle the condition and closes the channel. This also affected the channels 'string' and 'variable' (derivations of 'memchan'). Fixed all affected channels. Committed in Revision [fc756af785] Pushed. Thanks. |
