forked from platformio/platformio-core
Hint user to delete file manually when exception is raised
This commit is contained in:
@ -118,7 +118,7 @@ def main():
|
||||
try:
|
||||
configure()
|
||||
cli(None, None, None)
|
||||
except Exception as e: # pylint: disable=W0703
|
||||
except Exception as e: # pylint: disable=broad-except
|
||||
if not isinstance(e, exception.ReturnErrorCode):
|
||||
maintenance.on_platformio_exception(e)
|
||||
error_str = "Error: "
|
||||
|
@ -66,7 +66,7 @@ def cli():
|
||||
click.echo("Release notes: ", nl=False)
|
||||
click.secho(
|
||||
"http://docs.platformio.org/en/latest/history.html", fg="cyan")
|
||||
except Exception as e: # pylint: disable=W0703
|
||||
except Exception as e: # pylint: disable=broad-except
|
||||
if not r:
|
||||
raise exception.UpgradeError("\n".join([str(cmd), str(e)]))
|
||||
permission_errors = ("permission denied", "not permitted")
|
||||
|
@ -627,8 +627,13 @@ def pepver_to_semver(pepver):
|
||||
def rmtree_(path):
|
||||
|
||||
def _onerror(_, name, __):
|
||||
os.chmod(name, stat.S_IWRITE)
|
||||
os.remove(name)
|
||||
try:
|
||||
os.chmod(name, stat.S_IWRITE)
|
||||
os.remove(name)
|
||||
except Exception as e: # pylint: disable=broad-except
|
||||
click.secho(
|
||||
"Please manually remove file `%s`" % name, fg="red", err=True)
|
||||
raise e
|
||||
|
||||
return rmtree(path, onerror=_onerror)
|
||||
|
||||
|
Reference in New Issue
Block a user