summaryrefslogtreecommitdiffstats
path: root/generic
diff options
context:
space:
mode:
authorandreas_kupries <akupries@shaw.ca>2008-04-03 18:06:51 (GMT)
committerandreas_kupries <akupries@shaw.ca>2008-04-03 18:06:51 (GMT)
commitaee4b23dd9098622d39bdab07937703a502e75f6 (patch)
treeb5d731d4c7178391b6ba8cea3e6ba22bc025aa72 /generic
parent51e0552038c3bb5c4a3e2478a505cc69913730df (diff)
downloadtcl-aee4b23dd9098622d39bdab07937703a502e75f6.zip
tcl-aee4b23dd9098622d39bdab07937703a502e75f6.tar.gz
tcl-aee4b23dd9098622d39bdab07937703a502e75f6.tar.bz2
* generic/tclIO.c (CopyData): Applied patch [Bug 1932639] to
* tests/io.test: prevent fcopy from calling -command synchronously the first time. Thanks to Alexandre Ferrieux <ferrieux@users.sourceforge.net> for report and patch.
Diffstat (limited to 'generic')
-rw-r--r--generic/tclIO.c36
1 files changed, 23 insertions, 13 deletions
diff --git a/generic/tclIO.c b/generic/tclIO.c
index bf5eed5..aba2735 100644
--- a/generic/tclIO.c
+++ b/generic/tclIO.c
@@ -10,7 +10,7 @@
* See the file "license.terms" for information on usage and redistribution
* of this file, and for a DISCLAIMER OF ALL WARRANTIES.
*
- * RCS: @(#) $Id: tclIO.c,v 1.61.2.24 2008/04/02 20:27:58 andreas_kupries Exp $
+ * RCS: @(#) $Id: tclIO.c,v 1.61.2.25 2008/04/03 18:06:52 andreas_kupries Exp $
*/
#include "tclInt.h"
@@ -7835,22 +7835,32 @@ CopyData(csPtr, mask)
goto writeError;
}
- /*
- * Read up to bufSize bytes.
- */
+ if (cmdPtr && (mask == 0)) {
+ /*
+ * In async mode, we skip reading synchronously and fake an
+ * underflow instead to prime the readable fileevent.
+ */
- if ((csPtr->toRead == -1) || (csPtr->toRead > csPtr->bufSize)) {
- sizeb = csPtr->bufSize;
+ size = 0;
+ underflow = 1;
} else {
- sizeb = csPtr->toRead;
- }
+ /*
+ * Read up to bufSize bytes.
+ */
- if (inBinary || sameEncoding) {
- size = DoRead(inStatePtr->topChanPtr, csPtr->buffer, sizeb);
- } else {
- size = DoReadChars(inStatePtr->topChanPtr, bufObj, sizeb, 0 /* No append */);
+ if ((csPtr->toRead == -1) || (csPtr->toRead > csPtr->bufSize)) {
+ sizeb = csPtr->bufSize;
+ } else {
+ sizeb = csPtr->toRead;
+ }
+
+ if (inBinary || sameEncoding) {
+ size = DoRead(inStatePtr->topChanPtr, csPtr->buffer, sizeb);
+ } else {
+ size = DoReadChars(inStatePtr->topChanPtr, bufObj, sizeb, 0 /* No append */);
+ }
+ underflow = (size >= 0) && (size < sizeb); /* input underflow */
}
- underflow = (size >= 0) && (size < sizeb); /* input underflow */
if (size < 0) {
readError: