diff options
Diffstat (limited to 'kvmd/plugins/msd/__init__.py')
-rw-r--r-- | kvmd/plugins/msd/__init__.py | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/kvmd/plugins/msd/__init__.py b/kvmd/plugins/msd/__init__.py index 34efaafe..65da192c 100644 --- a/kvmd/plugins/msd/__init__.py +++ b/kvmd/plugins/msd/__init__.py @@ -27,6 +27,7 @@ import time from typing import AsyncGenerator import aiofiles +import aiofiles.os import aiofiles.base from ...logging import get_logger @@ -207,7 +208,7 @@ class MsdFileReader(BaseMsdReader): # pylint: disable=too-many-instance-attribu async def open(self) -> "MsdFileReader": assert self.__file is None get_logger(1).info("Reading %r image from MSD ...", self.__name) - self.__file_size = os.stat(self.__path).st_size + self.__file_size = (await aiofiles.os.stat(self.__path)).st_size self.__file = await aiofiles.open(self.__path, mode="rb") # type: ignore return self @@ -269,7 +270,7 @@ class MsdFileWriter(BaseMsdWriter): # pylint: disable=too-many-instance-attribu async def open(self) -> "MsdFileWriter": assert self.__file is None get_logger(1).info("Writing %r image (%d bytes) to MSD ...", self.__name, self.__file_size) - os.makedirs(os.path.dirname(self.__path), exist_ok=True) + await aiofiles.os.makedirs(os.path.dirname(self.__path), exist_ok=True) self.__file = await aiofiles.open(self.__path, mode="w+b", buffering=0) # type: ignore return self |