Try catched pyinotify's addMonitor (thanks William Witt)

This commit is contained in:
Clement Lefebvre 2010-09-23 10:05:48 +01:00
parent 4d7d61217c
commit 676dba72da

View File

@ -23,11 +23,13 @@ if hasInotify:
def addMonitor( self, filename, callback, args = None ): def addMonitor( self, filename, callback, args = None ):
try:
mask = pyinotify.IN_DELETE | pyinotify.IN_CREATE | pyinotify.IN_MODIFY mask = pyinotify.IN_DELETE | pyinotify.IN_CREATE | pyinotify.IN_MODIFY
mId = self.wm.add_watch( filename, mask, rec = True)[filename] mId = self.wm.add_watch( filename, mask, rec = True)[filename]
if mId >= 0: if mId >= 0:
self.callbacks[mId] = ( callback, args ) self.callbacks[mId] = ( callback, args )
except Exception, detail:
mId = 0
return mId return mId
def removeMonitor( self, monitorId ): def removeMonitor( self, monitorId ):