mirror of
https://github.com/tahoe-lafs/tahoe-lafs.git
synced 2025-02-21 02:01:31 +00:00
another primitive debug helper
This commit is contained in:
parent
cc5ebd2350
commit
0902277613
@ -187,7 +187,7 @@ def _open_directory(path_u):
|
||||
def simple_test():
|
||||
path_u = u"test"
|
||||
filter = FILE_NOTIFY_CHANGE_FILE_NAME | FILE_NOTIFY_CHANGE_DIR_NAME | FILE_NOTIFY_CHANGE_LAST_WRITE
|
||||
recursive = FALSE
|
||||
recursive = TRUE
|
||||
|
||||
hDirectory = _open_directory(path_u)
|
||||
fni = FileNotifyInformation()
|
||||
@ -198,6 +198,27 @@ def simple_test():
|
||||
for info in fni:
|
||||
print info
|
||||
|
||||
def medium_test():
|
||||
from twisted.python.filepath import FilePath
|
||||
|
||||
def print_(*event):
|
||||
print(event)
|
||||
|
||||
notifier = INotify()
|
||||
notifier.set_pending_delay(1.0)
|
||||
IN_EXCL_UNLINK = 0x04000000L
|
||||
mask = ( IN_CREATE
|
||||
| IN_CLOSE_WRITE
|
||||
| IN_MOVED_TO
|
||||
| IN_MOVED_FROM
|
||||
| IN_DELETE
|
||||
| IN_ONLYDIR
|
||||
| IN_EXCL_UNLINK
|
||||
)
|
||||
notifier.watch(FilePath(u"test"), mask, callbacks=[print_], recursive=True)
|
||||
notifier.startReading()
|
||||
reactor.run()
|
||||
|
||||
|
||||
NOT_STARTED = "NOT_STARTED"
|
||||
STARTED = "STARTED"
|
||||
|
Loading…
x
Reference in New Issue
Block a user