Found and hopefullyfixed a bug with fenrir watchdog.

This commit is contained in:
Storm Dragon
2026-07-26 20:44:50 -04:00
parent c863245c24
commit 9ac2e9e844
2 changed files with 38 additions and 2 deletions
@@ -263,9 +263,10 @@ class driver(screenDriver):
while True: while True:
# Read from file # Read from file
try: try:
d += file.readline(1) chunk = file.readline(1)
if not d: if not chunk:
break break
d += chunk
except Exception as e: except Exception as e:
break break
return d return d
+35
View File
@@ -0,0 +1,35 @@
from unittest.mock import Mock
from fenrirscreenreader.screenDriver.vcsaDriver import driver as VcsaDriver
class BulkReadFailure:
def __init__(self, chunks):
self.chunks = iter(chunks)
self.readline_calls = 0
def seek(self, offset):
assert offset == 0
def read(self):
raise OSError(22, "Invalid argument")
def readline(self, size):
assert size == 1
self.readline_calls += 1
if self.readline_calls > 3:
raise RuntimeError("read continued after EOF")
return next(self.chunks)
def test_vcsa_read_fallback_stops_at_eof():
vcsa_driver = VcsaDriver.__new__(VcsaDriver)
vcsa_driver.env = {
"runtime": {
"DebugManager": Mock(),
}
}
screen_file = BulkReadFailure([b"a", b"b", b""])
assert vcsa_driver.read_file(screen_file) == b"ab"
assert screen_file.readline_calls == 3