queue: skip a source file that a landing moves or rewrites mid-scan instead of crashing next_functions
This commit is contained in:
1 parent
9c74b17943
commit
1025c612b2
1 file changed
+4
@@ -47,8 +47,12 @@ class FunctionQueue:
|
|||||||
m = re.match(r"([0-9A-F]{6,8})_", path.name)
|
m = re.match(r"([0-9A-F]{6,8})_", path.name)
|
||||||
if not m:
|
if not m:
|
||||||
continue
|
continue
|
||||||
|
try:
|
||||||
with path.open(encoding="utf-8", errors="replace") as f:
|
with path.open(encoding="utf-8", errors="replace") as f:
|
||||||
head = [next(f, "") for _ in range(8)]
|
head = [next(f, "") for _ in range(8)]
|
||||||
|
except (FileNotFoundError, PermissionError):
|
||||||
|
continue # a landing on main moved or rewrote it while we scanned; its new path is found
|
||||||
|
|
||||||
status = "readable" if any(line.startswith(READABLE) for line in head) else \
|
status = "readable" if any(line.startswith(READABLE) for line in head) else \
|
||||||
next((line.split("status:", 1)[1].strip() for line in head if "status:" in line), "raw")
|
next((line.split("status:", 1)[1].strip() for line in head if "status:" in line), "raw")
|
||||||
out[int(m.group(1), 16)] = (status, path.name)
|
out[int(m.group(1), 16)] = (status, path.name)
|
||||||
|
|||||||
Reference in new issue
Block a user