From 2dbb8c45c0896314b294e26379badd5cc10fecf5 Mon Sep 17 00:00:00 2001 From: Jacob Henner Date: Thu, 13 Dec 2018 21:22:48 -0500 Subject: [PATCH] Use environment variables provided as an argument to run() Previously, they were accidentally being discarded during the encoding step. Resolves #55 --- src/vistir/misc.py | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/src/vistir/misc.py b/src/vistir/misc.py index eb91d79..cf30123 100644 --- a/src/vistir/misc.py +++ b/src/vistir/misc.py @@ -286,14 +286,11 @@ def run( _env = os.environ.copy() if env: _env.update(env) - env = _env if six.PY2: fs_encode = partial(to_bytes, encoding=locale_encoding) - _env = {fs_encode(k): fs_encode(v) for k, v in os.environ.items()} - for key, val in env.items(): - _env[fs_encode(key)] = fs_encode(val) + _env = {fs_encode(k): fs_encode(v) for k, v in _env.items()} else: - _env = {k: fs_str(v) for k, v in os.environ.items()} + _env = {k: fs_str(v) for k, v in _env.items()} if not spinner_name: spinner_name = "bouncingBar" if six.PY2: