1
0
mirror of https://github.com/nvbn/thefuck.git synced 2024-10-06 02:41:10 +01:00

better way to get shell

This commit is contained in:
Tevin Zhang 2015-05-18 18:44:55 +08:00
parent 02d9613618
commit 17b9104939

View File

@ -153,16 +153,16 @@ shells = defaultdict(lambda: Generic(), {
'bash': Bash(),
'fish': Fish(),
'zsh': Zsh(),
'-csh': Tcsh(),
'csh': Tcsh(),
'tcsh': Tcsh()})
def _get_shell():
try:
shell = Process(os.getpid()).parent().cmdline()[0]
shell = Process(os.getpid()).parent().name()
except TypeError:
shell = Process(os.getpid()).parent.cmdline[0]
return shells[os.path.basename(shell)]
shell = Process(os.getpid()).parent.name()
return shells[shell]
def from_shell(command):