From: SourceForge.net <no...@so...> - 2010-10-27 08:32:27
|
Bugs item #3096275, was opened at 2010-10-27 10:32 Message generated for change (Tracker Item Submitted) made by ferrieux You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=110894&aid=3096275&group_id=10894 Please note that this message will contain a full copy of the comment thread, including the initial issue submission, for this request, not just the latest update. Category: 25. Channel System Group: None Status: Open Resolution: None Priority: 5 Private: No Submitted By: Alexandre Ferrieux (ferrieux) Assigned to: Andreas Kupries (andreas_kupries) Summary: Sync fcopy buffers input Initial Comment: 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 :/ ---------------------------------------------------------------------- You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=110894&aid=3096275&group_id=10894 |