Skip to content

Commit

Permalink
see
Browse files Browse the repository at this point in the history
  • Loading branch information
ofek committed May 13, 2019
1 parent 07b221a commit d0eb83c
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
2 changes: 1 addition & 1 deletion tox.ini
Original file line number Diff line number Diff line change
Expand Up @@ -13,4 +13,4 @@ deps =
pytest
commands =
python setup.py --quiet clean develop
pytest
pytest -s
7 changes: 6 additions & 1 deletion userpath/interface.py
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,7 @@ def __init__(self, shells=None, all_shells=False, home=None):
shells = DEFAULT_SHELLS

# De-dup and retain order
print(shells)
deduplicated_shells = set()
selected_shells = []
for shell in shells:
Expand All @@ -96,16 +97,19 @@ def detect_shell(cls):
# First, try to see what spawned this process
shell = get_parent_process_name().lower()
if shell in SHELLS:
print('proc')
return shell

# Then, search for environment variables that are known to be set by certain shells
# NOTE: This likely does not work when not directly in the shell
if 'BASH_VERSION' in os.environ:
print('env')
return 'bash'

# Finally, try global environment
shell = os.path.basename(os.environ.get('SHELL', '')).lower()
if shell in SHELLS:
print('global')
return shell

def location_in_new_path(self, location):
Expand Down Expand Up @@ -140,7 +144,8 @@ def put(self, location, front=True, app_name=None):

with open(file, 'w', encoding='utf-8') as f:
f.writelines(lines)
except Exception:
except Exception as e:
print(e)
continue

return self.location_in_new_path(location)
Expand Down

0 comments on commit d0eb83c

Please sign in to comment.