mirror of
https://git.yoctoproject.org/poky
synced 2026-04-28 06:32:34 +02:00
oeqa/qemurunner: Handle files no longer existing gracefully
Files in /proc/xxx/map_files/ may no longer exist, just ignore this rather than raising an exception. (From OE-Core rev: fb1027896a263cd91e2378a4e97dbdf0807b306b) Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
This commit is contained in:
@@ -359,13 +359,16 @@ class QemuRunner:
|
||||
mapdir = "/proc/" + str(self.qemupid) + "/map_files/"
|
||||
try:
|
||||
for f in os.listdir(mapdir):
|
||||
linktarget = os.readlink(os.path.join(mapdir, f))
|
||||
if not linktarget.startswith("/") or linktarget.startswith("/dev") or "deleted" in linktarget:
|
||||
try:
|
||||
linktarget = os.readlink(os.path.join(mapdir, f))
|
||||
if not linktarget.startswith("/") or linktarget.startswith("/dev") or "deleted" in linktarget:
|
||||
continue
|
||||
with open(linktarget, "rb") as readf:
|
||||
data = True
|
||||
while data:
|
||||
data = readf.read(4096)
|
||||
except FileNotFoundError:
|
||||
continue
|
||||
with open(linktarget, "rb") as readf:
|
||||
data = True
|
||||
while data:
|
||||
data = readf.read(4096)
|
||||
# Centos7 doesn't allow us to read /map_files/
|
||||
except PermissionError:
|
||||
pass
|
||||
|
||||
Reference in New Issue
Block a user