Show
Ignore:
Timestamp:
05/10/04 12:07:30 (20 years ago)
Author:
jalet
Message:

Catches OSError while reading

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • pykota/trunk/bin/cupspykota

    r1465 r1466  
    2424# 
    2525# $Log$ 
     26# Revision 1.41  2004/05/10 10:07:30  jalet 
     27# Catches OSError while reading 
     28# 
    2629# Revision 1.40  2004/05/10 09:29:48  jalet 
    2730# Should be more robust if we receive a SIGTERM during an I/O operation 
     
    413416                    if (mask & select.POLLIN) or (mask & select.POLLPRI) :      
    414417                        # We have something to read 
    415                         data = os.read(fd, 256 * 1024) 
    416                         if fd == infno : 
    417                             indata += data 
    418                             if not data :    # If yes, then no more input data 
    419                                 self.unregisterFileNo(pollster, infno) 
    420                                 self.logdebug("Input data ends.") 
    421                                 endinput = 1 # this happens with real files. 
    422                         elif fd == fromcfno : 
    423                             outdata += data 
    424                         elif fd == cerrfno :     
    425                             errdata += data 
     418                        try : 
     419                            data = os.read(fd, 256 * 1024) 
     420                        except OSError, msg :     
     421                            self.logdebug("Error while reading file %s : %s" % (fd, msg) 
     422                        else : 
     423                            if fd == infno : 
     424                                indata += data 
     425                                if not data :    # If yes, then no more input data 
     426                                    self.unregisterFileNo(pollster, infno) 
     427                                    self.logdebug("Input data ends.") 
     428                                    endinput = 1 # this happens with real files. 
     429                            elif fd == fromcfno : 
     430                                outdata += data 
     431                            elif fd == cerrfno :     
     432                                errdata += data 
    426433                    if (mask & select.POLLHUP) or (mask & select.POLLERR) : 
    427434                        # I've never seen POLLERR myself, but this probably