Fix issue with subprocess pips closing
authorMarcel van der Veldt <m.vanderveldt@outlook.com>
Sun, 22 Feb 2026 13:53:11 +0000 (14:53 +0100)
committerMarcel van der Veldt <m.vanderveldt@outlook.com>
Sun, 22 Feb 2026 13:53:11 +0000 (14:53 +0100)
music_assistant/helpers/process.py

index a1287efa42d5dd75fbb00429748d9ba881d46f36..75cc310ca850c98918d75fb195799243ddface51 100644 (file)
@@ -359,14 +359,13 @@ class AsyncProcess:
             with suppress(asyncio.CancelledError, Exception):
                 await self._stderr_reader_task
 
-        # Close all pipes first to prevent any I/O blocking
-        # This helps processes stuck on blocked I/O to receive signals
+        # Close stdin to signal we're done sending data
+        # Note: Don't manually call feed_eof() on stdout/stderr - this causes
+        # "feed_data after feed_eof" assertion errors when the subprocess transport
+        # still has buffered data to deliver. Let the process termination naturally
+        # close the streams.
         if self.proc.stdin and not self.proc.stdin.is_closing():
             self.proc.stdin.close()
-        if self.proc.stdout:
-            self.proc.stdout.feed_eof()
-        if self.proc.stderr:
-            self.proc.stderr.feed_eof()
 
         # Send SIGKILL immediately using os.kill for more direct signal delivery
         self.logger.debug("Killing process %s with PID %s", self.name, pid)