Created
January 4, 2014 17:20
-
-
Save code-shoily/8257637 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import sys | |
from twisted.internet import inotify, reactor | |
from twisted.python import filepath | |
def change_handler(watch, path, mask): | |
# Call re-compile cmds etc on the file according to mask value via subprocess, perhaps? | |
print "WATCH: {}, PATH: {}, MASK: {}".format(watch, path, mask) | |
def start_notifying(path): | |
notifier = inotify.INotify() | |
notifier.startReading() | |
notifier.watch(filepath.FilePath(path), callbacks=[change_handler]) | |
if __name__ == "__main__": | |
start_notifying(sys.argv[1]) | |
reactor.start() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment