From d0eb83c4f02d7ff5ded06542c47ca41207327a6a Mon Sep 17 00:00:00 2001 From: Ofek Lev Date: Mon, 13 May 2019 01:16:50 -0400 Subject: [PATCH] see --- tox.ini | 2 +- userpath/interface.py | 7 ++++++- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/tox.ini b/tox.ini index 079bca5..76517a0 100644 --- a/tox.ini +++ b/tox.ini @@ -13,4 +13,4 @@ deps = pytest commands = python setup.py --quiet clean develop - pytest + pytest -s diff --git a/userpath/interface.py b/userpath/interface.py index c60caab..a1a23e5 100644 --- a/userpath/interface.py +++ b/userpath/interface.py @@ -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: @@ -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): @@ -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)