mirror of
https://github.com/platformio/platformio-core.git
synced 2025-07-30 10:07:14 +02:00
Fix removing locked files under windows
This commit is contained in:
@ -1,8 +1,9 @@
|
|||||||
# Copyright (C) Ivan Kravets <me@ikravets.com>
|
# Copyright (C) Ivan Kravets <me@ikravets.com>
|
||||||
# See LICENSE for details.
|
# See LICENSE for details.
|
||||||
|
|
||||||
|
import stat
|
||||||
from glob import glob
|
from glob import glob
|
||||||
from os import environ, makedirs, remove
|
from os import chmod, environ, makedirs, remove
|
||||||
from os.path import abspath, basename, isdir, isfile, join
|
from os.path import abspath, basename, isdir, isfile, join
|
||||||
from shutil import copyfile, copytree, rmtree
|
from shutil import copyfile, copytree, rmtree
|
||||||
from tempfile import mkdtemp
|
from tempfile import mkdtemp
|
||||||
@ -90,7 +91,10 @@ def cli(ctx, src, lib, exclude, board, # pylint: disable=R0913
|
|||||||
ctx.invoke(cmd_run, project_dir=build_dir, verbose=verbose)
|
ctx.invoke(cmd_run, project_dir=build_dir, verbose=verbose)
|
||||||
finally:
|
finally:
|
||||||
if not keep_build_dir:
|
if not keep_build_dir:
|
||||||
rmtree(build_dir, ignore_errors=True)
|
rmtree(
|
||||||
|
build_dir, onerror=lambda action, name, exc:
|
||||||
|
(chmod(name, stat.S_IWRITE), remove(name))
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
def _clean_dir(dirpath):
|
def _clean_dir(dirpath):
|
||||||
|
Reference in New Issue
Block a user