Tolerate vanished files
This commit is contained in:
parent
c619e74e15
commit
29491e1639
12
kitsune
12
kitsune
|
@ -90,9 +90,15 @@ def watch(args):
|
|||
for ln in lines:
|
||||
print(f"{f.path:{filename_length}}", format_ts(f.last_ts), dead, ln)
|
||||
else:
|
||||
stf = os.stat(f.path)
|
||||
if stf.st_ctime_ns != f.st_ctime_ns:
|
||||
f.reopen()
|
||||
try:
|
||||
stf = os.stat(f.path)
|
||||
if stf.st_ctime_ns != f.st_ctime_ns:
|
||||
f.reopen()
|
||||
except FileNotFoundError:
|
||||
# ignore,
|
||||
# or maybe remove from watched_files?
|
||||
# or just mark as deleted?
|
||||
pass
|
||||
time.sleep(0.1)
|
||||
seek_to_end = False
|
||||
|
||||
|
|
Loading…
Reference in New Issue