mirror of https://github.com/pypa/pip
Safeguard against sys.argv not existing.
This commit is contained in:
parent
5c3f415f23
commit
7492f9c23a
|
@ -28,7 +28,10 @@ __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
|
||||
return sys.argv[0]
|
||||
try:
|
||||
return sys.argv[0]
|
||||
except (TypeError, IndexError):
|
||||
return 'pip'
|
||||
|
||||
|
||||
def rmtree(dir, ignore_errors=False):
|
||||
|
|
Loading…
Reference in New Issue