beetbox / audioread

cross-library (GStreamer + Core Audio + MAD + FFmpeg) audio decoding for Python
MIT License
483 stars 108 forks source link

Fixes `subprocess` exception on WSL #66

Closed llamasoft closed 6 years ago

llamasoft commented 6 years ago

This fixes issue #51 regarding self.proc.kill() when running on Windows Subsystem for Linux. On WSL, ffmpeg is terminating normally, but returncode isn't being updated. Calling poll() on the subprocess returns immediately and forces an update of returncode. This allows the code to skip the kill() call if the process is already done.

sampsyo commented 6 years ago

Awesome! Thank you for figuring this out!

What do you think about indenting the following condition under your new if hasattr(self, 'proc'): check, which would make it simpler and a little easier to read?

llamasoft commented 6 years ago

I'm totally fine with that. Does the revised version look a bit better? 👍

sampsyo commented 6 years ago

Perfect! Thank you!! :sparkles: :rocket: