From 92bfa8f36db0a92b3e25f95b4424679bb0e7a668 Mon Sep 17 00:00:00 2001 From: Ivan Kravets Date: Mon, 18 May 2015 18:26:52 +0300 Subject: [PATCH] Fix removing locked files under windows --- platformio/commands/ci.py | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/platformio/commands/ci.py b/platformio/commands/ci.py index 0532f2d1..1ffdc97d 100644 --- a/platformio/commands/ci.py +++ b/platformio/commands/ci.py @@ -1,8 +1,9 @@ # Copyright (C) Ivan Kravets # See LICENSE for details. +import stat 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 shutil import copyfile, copytree, rmtree 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) finally: 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):