From 9ebb2654582384bdb0d6454265b0b1c81be47953 Mon Sep 17 00:00:00 2001 From: Fabio Manganiello Date: Sat, 2 Feb 2019 17:32:56 +0100 Subject: [PATCH] Only copy the environment to the mplayer executable if it's set, and don't copy the whole environment from platypush --- platypush/plugins/media/mplayer.py | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/platypush/plugins/media/mplayer.py b/platypush/plugins/media/mplayer.py index 871c74a7..4d879f24 100644 --- a/platypush/plugins/media/mplayer.py +++ b/platypush/plugins/media/mplayer.py @@ -112,13 +112,15 @@ class MediaMplayerPlugin(MediaPlugin): if arg not in args: args.append(arg) - env = os.environ.copy() - if self._env: - env.update(self._env) + popen_args = { + 'stdin': subprocess.PIPE, + 'stdout': subprocess.PIPE, + } - self._mplayer = subprocess.Popen(args, env=env, - stdin=subprocess.PIPE, - stdout=subprocess.PIPE) + if self._env: + popen_args['env'] = self._env + + self._mplayer = subprocess.Popen(args, **popen_args) def _build_actions(self): """ Populates the actions list by introspecting the mplayer executable """