Skip to content

Commit

Permalink
fix: handle missing FFmpegAudio._process in cleanup (DisnakeDev#1164)
Browse files Browse the repository at this point in the history
  • Loading branch information
shiftinv authored Mar 19, 2024
1 parent 227ec80 commit d92ba6a
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
1 change: 1 addition & 0 deletions changelog/1164.bugfix.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Avoid ``AttributeError`` in :class:`FFmpegAudio` when cleaning up after failing to spawn ffmpeg process.
7 changes: 6 additions & 1 deletion disnake/player.py
Original file line number Diff line number Diff line change
Expand Up @@ -175,7 +175,12 @@ def _spawn_process(self, args: Any, **subprocess_kwargs: Any) -> subprocess.Pope
raise ClientException(f"Popen failed: {exc.__class__.__name__}: {exc}") from exc

def _kill_process(self) -> None:
proc = self._process
try:
proc = self._process
except AttributeError:
# may occur if something errors while spawning process
return

if proc is MISSING:
return

Expand Down

0 comments on commit d92ba6a

Please sign in to comment.