Dont log inotify missing error when using branch coloring

The error message about inotify being missing when branch coloring is
enabled was being logged for every directory and for every invocation
of powerline in a shell, without powerline-daemon. Dont log it, since
the log is printed to stderr when using powerline in a shell without
powerline-daemon. Also improve the error message on OS X. Fixes #578
This commit is contained in:
Kovid Goyal 2013-07-03 09:40:05 +05:30
parent c1ae7f3598
commit 52c6bff67f
2 changed files with 3 additions and 1 deletions

View File

@ -26,6 +26,8 @@ def load_inotify():
# if the one chosen by ctypes is compatible with the currently
# loaded one.
raise INotifyError('INotify not available on windows')
if sys.platform == 'darwin':
raise INotifyError('INotify not available on OS X')
import ctypes
if not hasattr(ctypes, 'c_ssize_t'):
raise INotifyError('You need python >= 2.7 to use inotify')

View File

@ -162,7 +162,7 @@ class TreeWatcher(object):
try:
w = INotifyTreeWatcher(path, ignore_event=ignore_event)
except (INotifyError, DirTooLarge) as e:
if logger is not None:
if logger is not None and not isinstance(e, INotifyError):
logger.warn('Failed to watch path: {0} with error: {1}'.format(path, e))
w = DummyTreeWatcher(path)
self.watches[path] = w