To investigate the issue, please download the handle tool and placed it into C:
This handy command-line utility will show you what files are open by which processes, and much more.
Then modify your pre-execute action of the step to run below script:
groovy:
import com.pmease.quickbuild.util.*;
try {
FileUtils.cleanDir(configuration.workspaceDir);
} catch (Exception e) {
if (e.getMessage().contains("Failed to delete file ")) {
def file = StringUtils.substringAfter(e.getMessage(), "'");
file = StringUtils.substringBefore(file, "'");
def stdout = new StringBuffer();
def stderr = new StringBuffer();
("C:\\handle64.exe " + file).execute().waitForProcessOutput(stdout, stderr);
logger.info(stdout.toString());
logger.error(stderr.toString());
}
throw e;
}
When this issue happens again, the process using the file should be printed to build log