diff --git a/discord/player.py b/discord/player.py index cbfd000af..d5540a567 100644 --- a/discord/player.py +++ b/discord/player.py @@ -51,6 +51,11 @@ __all__ = ( 'PCMVolumeTransformer', ) +if sys.platform != 'win32': + CREATE_NO_WINDOW = 0 +else: + CREATE_NO_WINDOW = 0x08000000 + class AudioSource: """Represents an audio stream. @@ -136,7 +141,7 @@ class FFmpegAudio(AudioSource): def _spawn_process(self, args, **subprocess_kwargs): process = None try: - process = subprocess.Popen(args, **subprocess_kwargs) + process = subprocess.Popen(args, creationflags=CREATE_NO_WINDOW, **subprocess_kwargs) except FileNotFoundError: executable = args.partition(' ')[0] if isinstance(args, str) else args[0] raise ClientException(executable + ' was not found.') from None @@ -469,7 +474,7 @@ class FFmpegOpusAudio(FFmpegAudio): @staticmethod def _probe_codec_fallback(source, executable='ffmpeg'): args = [executable, '-hide_banner', '-i', source] - proc = subprocess.Popen(args, stdout=subprocess.PIPE, stderr=subprocess.STDOUT) + proc = subprocess.Popen(args, creationflags=CREATE_NO_WINDOW, stdout=subprocess.PIPE, stderr=subprocess.STDOUT) out, _ = proc.communicate(timeout=20) output = out.decode('utf8') codec = bitrate = None