Posted to tcl by avl at Tue Apr 11 00:16:04 GMT 2017view pretty
Index: generic/tclIO.c
==================================================================
--- generic/tclIO.c
+++ generic/tclIO.c
@@ -8874,12 +8874,12 @@
ChannelState *statePtr; /* State info for channel */
Tcl_Channel chan; /* The opaque type for the channel. */
const char *chanName;
int modeIndex; /* Index of mode argument. */
int mask;
- static const char *const modeOptions[] = {"readable", "writable", NULL};
- static const int maskArray[] = {TCL_READABLE, TCL_WRITABLE};
+ static const char *const modeOptions[] = {"readable", "writable", "exception", NULL};
+ static const int maskArray[] = {TCL_READABLE, TCL_WRITABLE, TCL_EXCEPTION };
if ((objc != 3) && (objc != 4)) {
Tcl_WrongNumArgs(interp, 1, objv, "channelId event ?script?");
return TCL_ERROR;
}
@@ -8894,11 +8894,11 @@
if (chan == NULL) {
return TCL_ERROR;
}
chanPtr = (Channel *) chan;
statePtr = chanPtr->state;
- if ((statePtr->flags & mask) == 0) {
+ if ( ((statePtr->flags | TCL_EXCEPTION) & mask) == 0) {
Tcl_SetObjResult(interp, Tcl_ObjPrintf("channel is not %s",
(mask == TCL_READABLE) ? "readable" : "writable"));
return TCL_ERROR;
}