mirror of
https://github.com/kennethreitz/pipenv.git
synced 2026-06-05 22:50:18 +00:00
conservative check for known exceptions in subprocess stderr.
This commit is contained in:
+10
-2
@@ -925,9 +925,17 @@ def do_create_virtualenv(python=None, site_packages=False, pypi_mirror=None):
|
||||
)
|
||||
click.echo(crayons.blue("{0}".format(c.out)), err=True)
|
||||
if c.returncode != 0:
|
||||
sp.fail(environments.PIPENV_SPINNER_FAIL_TEXT.format(u"Failed creating virtual environment"))
|
||||
sp.fail(environments.PIPENV_SPINNER_FAIL_TEXT.format("Failed creating virtual environment"))
|
||||
known_exceptions = {
|
||||
"PermissionError": "Permission denied:",
|
||||
}
|
||||
# PermissionError - hide the traceback for better UX
|
||||
for partition in (part
|
||||
for e, part in known_exceptions.items() if e in c.err):
|
||||
known_exceptions_partition = c.err.rpartition(partition)
|
||||
c.err = "{} {}".format(known_exceptions_partition[1], known_exceptions_partition[2])
|
||||
raise exceptions.VirtualenvCreationException(
|
||||
extra=[crayons.blue("{0}".format(c.err)),]
|
||||
extra=[crayons.red("{0}".format(c.err)),]
|
||||
)
|
||||
else:
|
||||
|
||||
|
||||
Reference in New Issue
Block a user