Changeset 1249 for trunk/packages/vizservers/nanovis
- Timestamp:
- Dec 1, 2008, 12:50:26 PM (16 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/packages/vizservers/nanovis/nanovis.cpp
r1248 r1249 2167 2167 2168 2168 int status = TCL_OK; 2169 int npass = 0;2170 2169 2171 2170 // 2172 2171 // Read and execute as many commands as we can from stdin... 2173 2172 // 2173 bool isComplete = false; 2174 2174 while (status == TCL_OK) { 2175 2175 // … … 2190 2190 char ch; 2191 2191 if (c <= 0) { 2192 if (npass == 0) { 2193 DoExit(0); 2194 } else { 2192 if (errno == EWOULDBLOCK) { 2195 2193 break; 2196 } 2194 } 2195 DoExit(0); 2197 2196 } 2198 2197 ch = (char)c; 2199 2198 Tcl_DStringAppend(&cmdbuffer, &ch, 1); 2200 if (ch=='\n' && Tcl_CommandComplete(Tcl_DStringValue(&cmdbuffer))) { 2201 break; 2199 if (ch == '\n') { 2200 isComplete = Tcl_CommandComplete(Tcl_DStringValue(&cmdbuffer)); 2201 if (isComplete) { 2202 break; 2203 } 2202 2204 } 2203 2205 } … … 2207 2209 } 2208 2210 2209 // back to original flags during command evaluation... 2210 fcntl(0, F_SETFL, flags & ~O_NONBLOCK); 2211 status = ExecuteCommand(interp, &cmdbuffer); 2212 // non-blocking for next read -- we might not get anything 2213 fcntl(0, F_SETFL, flags | O_NONBLOCK); 2214 npass++; 2211 if (isComplete) { 2212 // back to original flags during command evaluation... 2213 fcntl(0, F_SETFL, flags & ~O_NONBLOCK); 2214 status = ExecuteCommand(interp, &cmdbuffer); 2215 // non-blocking for next read -- we might not get anything 2216 fcntl(0, F_SETFL, flags | O_NONBLOCK); 2217 isComplete = false; 2218 } 2215 2219 } 2216 2220 fcntl(0, F_SETFL, flags);
Note: See TracChangeset
for help on using the changeset viewer.