Skip to content

Commit aed194c

Browse files
committed
ensure that named pipes are created
1 parent 0d5fe34 commit aed194c

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

music_assistant/providers/airplay/protocols/_protocol.py

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -106,6 +106,10 @@ async def finish_pairing(self, pin: str) -> str:
106106

107107
async def _open_pipes(self) -> None:
108108
"""Open both named pipes in non-blocking mode for async I/O."""
109+
# Create named pipes first if they don't exist
110+
await asyncio.to_thread(self._create_named_pipe, self.audio_named_pipe)
111+
await asyncio.to_thread(self._create_named_pipe, self.commands_named_pipe)
112+
109113
# Open audio pipe with buffer size optimization
110114
self._audio_pipe = AsyncNamedPipeWriter(self.audio_named_pipe, logger=self.player.logger)
111115
await self._audio_pipe.open(increase_buffer=True)
@@ -118,6 +122,11 @@ async def _open_pipes(self) -> None:
118122

119123
self.player.logger.debug("Named pipes opened in non-blocking mode for streaming session")
120124

125+
def _create_named_pipe(self, pipe_path: str) -> None:
126+
"""Create a named pipe (FIFO) if it doesn't exist."""
127+
if not os.path.exists(pipe_path):
128+
os.mkfifo(pipe_path)
129+
121130
async def stop(self) -> None:
122131
"""Stop playback and cleanup."""
123132
# Send stop command before setting _stopped flag

0 commit comments

Comments
 (0)