mirror of
https://github.com/platformio/platformio-core.git
synced 2025-07-30 01:57:13 +02:00
Hint user to delete file manually when exception is raised
This commit is contained in:
@ -118,7 +118,7 @@ def main():
|
|||||||
try:
|
try:
|
||||||
configure()
|
configure()
|
||||||
cli(None, None, None)
|
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):
|
if not isinstance(e, exception.ReturnErrorCode):
|
||||||
maintenance.on_platformio_exception(e)
|
maintenance.on_platformio_exception(e)
|
||||||
error_str = "Error: "
|
error_str = "Error: "
|
||||||
|
@ -66,7 +66,7 @@ def cli():
|
|||||||
click.echo("Release notes: ", nl=False)
|
click.echo("Release notes: ", nl=False)
|
||||||
click.secho(
|
click.secho(
|
||||||
"http://docs.platformio.org/en/latest/history.html", fg="cyan")
|
"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:
|
if not r:
|
||||||
raise exception.UpgradeError("\n".join([str(cmd), str(e)]))
|
raise exception.UpgradeError("\n".join([str(cmd), str(e)]))
|
||||||
permission_errors = ("permission denied", "not permitted")
|
permission_errors = ("permission denied", "not permitted")
|
||||||
|
@ -627,8 +627,13 @@ def pepver_to_semver(pepver):
|
|||||||
def rmtree_(path):
|
def rmtree_(path):
|
||||||
|
|
||||||
def _onerror(_, name, __):
|
def _onerror(_, name, __):
|
||||||
os.chmod(name, stat.S_IWRITE)
|
try:
|
||||||
os.remove(name)
|
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)
|
return rmtree(path, onerror=_onerror)
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user