Skip to content

Commit

Permalink
Fixes #30
Browse files Browse the repository at this point in the history
  • Loading branch information
mottosso committed Jul 2, 2015
1 parent 0841f5a commit b9e9643
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 1 deletion.
1 change: 1 addition & 0 deletions be/cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -525,6 +525,7 @@ def activate():
os.path.dirname(__file__), "_autocomplete.sh").replace("\\", "/")

context.pop("BE_ACTIVE")
context.pop("BE_ACTIVE")

sys.exit(subprocess.call(cmd, env=context))

Expand Down
20 changes: 19 additions & 1 deletion be/lib.py
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,19 @@ def cmd(parent):


def context(project):
"""Produce the be environment
The environment is an exact replica of the active
environment of the current process, with a few
additional variables, all of which are listed below.
The `be` environment are considered "defaults" that
may be overwritten by the incoming environment, with
the exception of BE_CWD which must always be the
real current working directory.
"""

environment = {
"BE_PROJECT": project,
"BE_ALIASDIR": "",
Expand All @@ -133,7 +146,12 @@ def context(project):
"BE_TABCOMPLETION": ""
}

environment.update(os.environ)
# Do not overwrite BE_CWD
# from incoming environment.
environ = os.environ.copy()
environ.pop("BE_CWD", None)

environment.update(environ)

return environment

Expand Down

0 comments on commit b9e9643

Please sign in to comment.