Tcl Source Code

Artifact [9d01dc0125]
Login

Artifact 9d01dc0125ee1c881bfa85b063a8e920f2d80ca2:

Attachment "flush_channel.patch" to ticket [1758a0b603] added by a3a3el 2014-03-21 15:14:30. (unpublished)
Index: generic/tclIO.c
==================================================================
--- generic/tclIO.c
+++ generic/tclIO.c
@@ -2613,17 +2613,18 @@
      * channel becomes writable again. This ensures that all of the pending
      * data has been flushed at the system level.
      */
 
     if (statePtr->flags & BG_FLUSH_SCHEDULED) {
-	if (wroteSome) {
-	    return errorCode;
-	} else if (statePtr->outQueueHead == NULL) {
+	if (statePtr->outQueueHead == NULL) {
 	    ResetFlag(statePtr, BG_FLUSH_SCHEDULED);
 	    (chanPtr->typePtr->watchProc)(chanPtr->instanceData,
 		    statePtr->interestMask);
 	}
+	if (wroteSome) {
+	    return errorCode;
+	}
     }
 
     /*
      * If the channel is flagged as closed, delete it when the refCount drops
      * to zero, the output queue is empty and there is no output in the