Compare commits
No commits in common. "93cf7b35b992d049949aeb31b0594089dcf28028" and "25717fff98358c43950e5a304f00b210590d1235" have entirely different histories.
93cf7b35b9
...
25717fff98
22
kitsune
22
kitsune
|
@ -54,18 +54,12 @@ def watch(args):
|
||||||
if st.st_mtime_ns > last_ts:
|
if st.st_mtime_ns > last_ts:
|
||||||
last_ts = st.st_mtime_ns
|
last_ts = st.st_mtime_ns
|
||||||
for de in os.scandir(d):
|
for de in os.scandir(d):
|
||||||
try:
|
if de.is_file():
|
||||||
if de.is_file():
|
if args.match_filename is None or fnmatch.fnmatch(de.name, args.match_filename):
|
||||||
if args.match_filename is None or fnmatch.fnmatch(de.name, args.match_filename):
|
if de.path not in watched_files:
|
||||||
if de.path not in watched_files:
|
watched_files[de.path] = WatchedFile(de.path, seek_to_end)
|
||||||
watched_files[de.path] = WatchedFile(de.path, seek_to_end)
|
if len(de.path) > filename_length:
|
||||||
if len(de.path) > filename_length:
|
filename_length = len(de.path)
|
||||||
filename_length = len(de.path)
|
|
||||||
except (PermissionError, OSError):
|
|
||||||
# ignore,
|
|
||||||
# or maybe remove from watched_files?
|
|
||||||
# or just mark as unavailable?
|
|
||||||
pass
|
|
||||||
|
|
||||||
# has any of the files changed
|
# has any of the files changed
|
||||||
for f in watched_files.values():
|
for f in watched_files.values():
|
||||||
|
@ -77,7 +71,7 @@ def watch(args):
|
||||||
if stf.st_ino != st.st_ino:
|
if stf.st_ino != st.st_ino:
|
||||||
f.reopen()
|
f.reopen()
|
||||||
st = os.stat(f.fileno)
|
st = os.stat(f.fileno)
|
||||||
except (FileNotFoundError, PermissionError):
|
except FileNotFoundError:
|
||||||
# ignore,
|
# ignore,
|
||||||
# or maybe remove from watched_files?
|
# or maybe remove from watched_files?
|
||||||
# or just mark as deleted?
|
# or just mark as deleted?
|
||||||
|
@ -106,7 +100,7 @@ def watch(args):
|
||||||
stf = os.stat(f.path)
|
stf = os.stat(f.path)
|
||||||
if stf.st_ctime_ns != f.st_ctime_ns:
|
if stf.st_ctime_ns != f.st_ctime_ns:
|
||||||
f.reopen()
|
f.reopen()
|
||||||
except (FileNotFoundError, PermissionError):
|
except FileNotFoundError:
|
||||||
# ignore,
|
# ignore,
|
||||||
# or maybe remove from watched_files?
|
# or maybe remove from watched_files?
|
||||||
# or just mark as deleted?
|
# or just mark as deleted?
|
||||||
|
|
Loading…
Reference in New Issue