From cfa51506fb546296d7f60e400c334266d8f5668d Mon Sep 17 00:00:00 2001 From: BlahGeek Date: Sat, 20 Aug 2016 12:00:03 +0800 Subject: [PATCH] prevent infinity loop while detecting shell In OS X, Process(pid=0).parent() == Process(pid=0) --- thefuck/shells/__init__.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/thefuck/shells/__init__.py b/thefuck/shells/__init__.py index 0413f6bf..9a62225f 100644 --- a/thefuck/shells/__init__.py +++ b/thefuck/shells/__init__.py @@ -22,7 +22,7 @@ shells = {'bash': Bash, def _get_shell(): proc = Process(os.getpid()) - while proc is not None: + while proc is not None and proc.pid > 0: try: name = proc.name() except TypeError: