summaryrefslogtreecommitdiffstats
path: root/generic/tclIO.c
diff options
context:
space:
mode:
authorandreas_kupries <akupries@shaw.ca>2008-04-03 18:06:23 (GMT)
committerandreas_kupries <akupries@shaw.ca>2008-04-03 18:06:23 (GMT)
commitf22c720323ae972ba91834691c7c0ad1b800d2df (patch)
tree7b2996d1dacdf61537357d21e7203fb0421aaeb6 /generic/tclIO.c
parent5d04951fcf71ab20d6f470ec05cd5edae97f31a0 (diff)
downloadtcl-f22c720323ae972ba91834691c7c0ad1b800d2df.zip
tcl-f22c720323ae972ba91834691c7c0ad1b800d2df.tar.gz
tcl-f22c720323ae972ba91834691c7c0ad1b800d2df.tar.bz2
* generic/tclIO.c (CopyData): Applied patch [Bug 1932639] to
* tests/io.test: prevent fcopy from calling -command synchronously * tests/chanio.test: the first time. Thanks to Alexandre Ferrieux <ferrieux@users.sourceforge.net> for report and patch.
Diffstat (limited to 'generic/tclIO.c')
-rw-r--r--generic/tclIO.c38
1 files changed, 24 insertions, 14 deletions
diff --git a/generic/tclIO.c b/generic/tclIO.c
index 8222681..eadd56b 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.137.2.1 2008/04/02 20:27:08 andreas_kupries Exp $
+ * RCS: @(#) $Id: tclIO.c,v 1.137.2.2 2008/04/03 18:06:24 andreas_kupries Exp $
*/
#include "tclInt.h"
@@ -8578,23 +8578,33 @@ CopyData(
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: