Skip to content
Snippets Groups Projects
Commit 6cdbc33c authored by Seth R Johnson's avatar Seth R Johnson Committed by Peter Scheibel
Browse files

Hide some variables in spack-build.env file

Don't arbitrarily reset PWD and OLDPWD when sourcing, as well as other
session-specific IDs
parent e4ce4e5c
No related branches found
No related tags found
No related merge requests found
......@@ -119,10 +119,14 @@ def env_var_to_source_line(var, val):
def dump_environment(path, environment=None):
"""Dump an environment dictionary to a source-able file."""
use_env = environment if environment else os.environ
use_env = environment or os.environ
hidden_vars = set(['PS1', 'PWD', 'OLDPWD', 'TERM_SESSION_ID'])
with open(path, 'w') as env_file:
for var, val in sorted(use_env.items()):
env_file.write('{0}\n'.format(env_var_to_source_line(var, val)))
env_file.write(''.join(['#' if var in hidden_vars else '',
env_var_to_source_line(var, val),
'\n']))
def pickle_environment(path, environment=None):
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment