From: Marcel van der Veldt Date: Sun, 22 Feb 2026 01:19:59 +0000 (+0100) Subject: Add some additional guards to asyncprocess X-Git-Url: https://git.kitaultman.com/?a=commitdiff_plain;h=4615edcaf88a86f192f3dc9c9faa5c295dcfc9a3;p=music-assistant-server.git Add some additional guards to asyncprocess --- diff --git a/music_assistant/helpers/process.py b/music_assistant/helpers/process.py index 1da3541f..090df1ee 100644 --- a/music_assistant/helpers/process.py +++ b/music_assistant/helpers/process.py @@ -171,10 +171,10 @@ class AsyncProcess: async def write(self, data: bytes) -> None: """Write data to process stdin.""" - if self._close_called: + if self._close_called or self.proc is None: + return + if self.proc.stdin is None: return - assert self.proc is not None # for type checking - assert self.proc.stdin is not None # for type checking async with self._stdin_lock: self.proc.stdin.write(data) with suppress(BrokenPipeError, ConnectionResetError): @@ -182,10 +182,10 @@ class AsyncProcess: async def write_eof(self) -> None: """Write end of file to to process stdin.""" - if self._close_called: + if self._close_called or self.proc is None: + return + if self.proc.stdin is None: return - assert self.proc is not None # for type checking - assert self.proc.stdin is not None # for type checking async with self._stdin_lock: try: if self.proc.stdin.can_write_eof():