Only copy the environment to the mplayer executable if it's set, and don't copy the whole environment from platypush

This commit is contained in:
Fabio Manganiello 2019-02-02 17:32:56 +01:00
parent c18650c964
commit 9ebb265458

View file

@ -112,13 +112,15 @@ class MediaMplayerPlugin(MediaPlugin):
if arg not in args: if arg not in args:
args.append(arg) args.append(arg)
env = os.environ.copy() popen_args = {
if self._env: 'stdin': subprocess.PIPE,
env.update(self._env) 'stdout': subprocess.PIPE,
}
self._mplayer = subprocess.Popen(args, env=env, if self._env:
stdin=subprocess.PIPE, popen_args['env'] = self._env
stdout=subprocess.PIPE)
self._mplayer = subprocess.Popen(args, **popen_args)
def _build_actions(self): def _build_actions(self):
""" Populates the actions list by introspecting the mplayer executable """ """ Populates the actions list by introspecting the mplayer executable """