Overview
| Artifact ID: | 2359aa3691cfed38b5802190f33ce45d05600257 |
|---|---|
| Ticket: | 3096275fffffffffffffffffffffffffffffffff
Sync fcopy buffers input |
| User & Date: | ferrieux on 2010-10-27 08:32:25 |
Changes
- assignee changed to: "andreas_kupries"
- cmimetype changed to: "text/plain"
- comment changed to:
The following script: fconfigure stdin -translation binary -blocking 0 fconfigure stdout -buffering none -translation binary fcopy stdin stdout when fed by typing lines to stdin, will not output anything until either 4k have been typed or eof, despite the nonblocking mode on stdin. The same using an async fcopy, will work in a more responsive manner: fcopy stdin stdout -command done vwait forever This is a consequence of the following credo, in a comment in TclCopyChannel: /* * Set up the blocking mode appropriately. Background copies need * non-blocking channels. Foreground copies need blocking channels. If * there is an error, restore the old blocking mode. */ As a consequence, while GetInput happily returns short reads, DoRead insists on filling up its 4k buffer. That is, sync fcopy will never pass short reads on to the output channel. Hence, sync fcopy is not adapted to live streams, while async fcopy is. This it at least surprising for the developer, since the sync/async fcopy decision is rather based on external considerations like "do I need to interleave it with other IO" or "do I need to keep a GUI responsive". The fact that chosing sync implies buffering by 4k is nowhere in the docs. Low prio because it's a Day-1 issue :/ - foundin changed to: "None"
- is_private changed to: "0"
- priority changed to: "5 Medium"
- resolution changed to: "None"
- status changed to: "Open"
- submitter changed to: "ferrieux"
- subsystem changed to: "25. Channel System"
- title changed to: "Sync fcopy buffers input"
- type changed to: "Bug"