diff options
author | Sebastien Martini <seb@dbzteam.org> | 2010-05-19 14:12:31 +0200 |
---|---|---|
committer | Sebastien Martini <seb@dbzteam.org> | 2010-05-19 14:12:31 +0200 |
commit | be91bfbbe7a849952b2fe61a49205d66fb5c850c (patch) | |
tree | e5cb32d985c19fd310cbc43beb9cc06c469e56c8 | |
parent | fc7f2b79d73b25bbf3f1eb3a677c16e449a24564 (diff) | |
download | pyinotify-be91bfbbe7a849952b2fe61a49205d66fb5c850c.tar.gz |
add_watch() returns immediately on first encountered ENOSPC error even
if quiet=True (idea submitted by Matthew Webber Matthew.Webber@diamond.ac.uk).
-rwxr-xr-x | python2/pyinotify.py | 7 | ||||
-rwxr-xr-x | python3/pyinotify.py | 5 |
2 files changed, 12 insertions, 0 deletions
diff --git a/python2/pyinotify.py b/python2/pyinotify.py index 3ff0f05..6f24a3f 100755 --- a/python2/pyinotify.py +++ b/python2/pyinotify.py @@ -1646,6 +1646,8 @@ class WatchManager: If |path| si already watched it is ignored, but if it is called with option rec=True a watch is put on each one of its not-watched subdirectory. + This method returns immediately on first ENOSPC error encountered + (see http://trac.dbzteam.org/pyinotify/wiki/FrequentlyAskedQuestions). @param path: Path to watch, the path can either be a file or a directory. Also accepts a sequence (list) of paths. @@ -1707,6 +1709,11 @@ class WatchManager: err = err % (rpath, wd, STRERRNO()) if quiet: log.error(err) + if (sys.version_info[0] >= 2 and + sys.version_info[1] >= 6 and + errno.ENOSPC == ctypes.get_errno()): + # In this case return immediately + return ret_ else: raise WatchManagerError(err, ret_) else: diff --git a/python3/pyinotify.py b/python3/pyinotify.py index c3de72a..c3b7626 100755 --- a/python3/pyinotify.py +++ b/python3/pyinotify.py @@ -1593,6 +1593,8 @@ class WatchManager: If |path| is already watched it is ignored, but if it is called with option rec=True a watch is put on each one of its not-watched subdirectory. + This method returns immediately on first ENOSPC error encountered + (see http://trac.dbzteam.org/pyinotify/wiki/FrequentlyAskedQuestions). @param path: Path to watch, the path can either be a file or a directory. Also accepts a sequence (list) of paths. @@ -1658,6 +1660,9 @@ class WatchManager: err = err % (rpath, wd, STRERRNO()) if quiet: log.error(err) + if errno.ENOSPC == ctypes.get_errno(): + # In this case return immediately + return ret_ else: raise WatchManagerError(err, ret_) else: |