diff options
| author | Terrance <[email protected]> | 2020-04-27 08:56:45 +0100 |
|---|---|---|
| committer | Rapptz <[email protected]> | 2020-05-23 21:43:26 -0400 |
| commit | 017591dc9ef74135717c8dc426291dfc09297004 (patch) | |
| tree | 482e7bc95b4d25392f3e8c637ce579b37441f5d9 | |
| parent | state: use bytes.hex() instead of binascii.hexlify().decode() (diff) | |
| download | discord.py-017591dc9ef74135717c8dc426291dfc09297004.tar.xz discord.py-017591dc9ef74135717c8dc426291dfc09297004.zip | |
player: Close ffmpeg stdin during streaming
A `stdin` of `None` means the ffmpeg subprocess input inherits from the
parent process, which may cause undesired control from a terminal (e.g.
`C` causes ffmpeg to prompt for a command). It also closes the parent's
stdin when the subprocess exits.
This commit switches to `subprocess.DEVNULL`, which provides a separate
pre-closed stdin for ffmpeg subprocesses.
| -rw-r--r-- | discord/player.py | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/discord/player.py b/discord/player.py index f62d75ea..c3102512 100644 --- a/discord/player.py +++ b/discord/player.py @@ -203,7 +203,7 @@ class FFmpegPCMAudio(FFmpegAudio): def __init__(self, source, *, executable='ffmpeg', pipe=False, stderr=None, before_options=None, options=None): args = [] - subprocess_kwargs = {'stdin': source if pipe else None, 'stderr': stderr} + subprocess_kwargs = {'stdin': source if pipe else subprocess.DEVNULL, 'stderr': stderr} if isinstance(before_options, str): args.extend(shlex.split(before_options)) @@ -293,7 +293,7 @@ class FFmpegOpusAudio(FFmpegAudio): pipe=False, stderr=None, before_options=None, options=None): args = [] - subprocess_kwargs = {'stdin': source if pipe else None, 'stderr': stderr} + subprocess_kwargs = {'stdin': source if pipe else subprocess.DEVNULL, 'stderr': stderr} if isinstance(before_options, str): args.extend(shlex.split(before_options)) |