Hint user to delete file manually when exception is raised

This commit is contained in:
Ivan Kravets
2017-09-24 01:28:41 +03:00
parent 1fab2a5bec
commit a0626ac958
3 changed files with 9 additions and 4 deletions

View File

@ -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: "

View File

@ -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")

View File

@ -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)