提交 7760a01d 编写于 作者: J Jannis Leidel

Simplified get_prog to not trigger any exception.

上级 7492f9c2
......@@ -26,11 +26,11 @@ __all__ = ['rmtree', 'display_path', 'backup_dir',
def get_prog():
if hasattr(sys, 'argv') and sys.argv and os.path.basename(sys.argv[0]) in ('__main__.py', '-c'):
return "%s -m pip" % sys.executable
try:
return sys.argv[0]
except (TypeError, IndexError):
if os.path.basename(sys.argv[0]) in ('__main__.py', '-c'):
return "%s -m pip" % sys.executable
except (AttributeError, TypeError, IndexError):
pass
return 'pip'
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册