summaryrefslogtreecommitdiff
path: root/alot/helper.py
diff options
context:
space:
mode:
authorDylan Baker <dylan@pnwbakers.com>2017-08-22 12:01:35 -0700
committerDylan Baker <dylan@pnwbakers.com>2017-08-22 14:46:32 -0700
commit3fe43d7dfd9228771daca82789295cceb5f37854 (patch)
tree647baab19fd398d3e4ff238d1cf2ebd12659b097 /alot/helper.py
parent0f5dcac8dd61564c8e575ee13e5a04324320b10d (diff)
alot/helper: Fix call_cmd_async polluting global environment
An assignment `e = os.environ` creates a reference not a copy, which means that modifying one necessarily modifies the other. Using `dict.copy` creates a shallow copy (the keys and values are references, but the dicts are different objects), which means only modifications to mutable objects are shared. In the case of os.environ which only contains immutable objects like strings, bools, and numbers this isn't an issue.
Diffstat (limited to 'alot/helper.py')
-rw-r--r--alot/helper.py2
1 files changed, 1 insertions, 1 deletions
diff --git a/alot/helper.py b/alot/helper.py
index 4cd01b77..26787fa8 100644
--- a/alot/helper.py
+++ b/alot/helper.py
@@ -333,7 +333,7 @@ def call_cmd_async(cmdlist, stdin=None, env=None):
self.deferred.errback(terminated_obj)
d = Deferred()
- environment = os.environ
+ environment = os.environ.copy()
if env is not None:
environment.update(env)
logging.debug('ENV = %s', environment)