Slightly better `xonsh` check hack, fix typing

prompt_on_ctrlc
Tyler Goodlet 2023-01-26 15:48:15 -05:00
parent 9e5c8ce6f6
commit 5b8a87d0f6
1 changed files with 12 additions and 5 deletions

View File

@ -197,7 +197,7 @@ class MultiActorPdb(pdbpp.Pdb):
self.cmdloop()
@cached_property
def shname(self) -> str:
def shname(self) -> str | None:
'''
Attempt to return the login shell name with a special check for
the infamous `xonsh` since it seems to have some issues much
@ -206,11 +206,18 @@ class MultiActorPdb(pdbpp.Pdb):
'''
# SUPER HACKY and only really works if `xonsh` is not used
# before spawning further sub-shells..
xonsh_is_login_sh: bool = os.getenv('XONSH_LOGIN', default=False)
if xonsh_is_login_sh:
shpath = os.getenv('SHELL', None)
if shpath:
if (
os.getenv('XONSH_LOGIN', default=False)
or 'xonsh' in shpath
):
return 'xonsh'
return os.path.basename(os.getenv('SHELL'))
return os.path.basename(shpath)
return None
@acm