def unwatch(self, path, parent): """Handles unwatch commands. A process that wishes to stop watching a directory will issue an unwatch command. This method removes the watch if necessary.""" self._logger.info("Unwatch command ran for {} by {}".format(path, parent)) try: watch_manager = WatchManager(self._task_runner, self._file_watcher) except IOError as e: self._logger.error("I/O error({0}): {1}".format(e.errno, e.strerror)) return os.EX_IOERR except cPickle.UnpicklingError as e: return OS.EX_IOERR try: watch_manager.remove(parent, path) except OSError as e: self._logger.error(e) return os.EX_UNAVAILABLE except WatchManagerError as e: return os.EX_IOERR