Your browser was unable to load all of the resources. They may have been blocked by your firewall, proxy or browser configuration.
Press Ctrl+F5 or Ctrl+Shift+R to have your browser try again.

Error on pre-clean #4115

tardis4500 ·

I have a configuration that occasionally errs out why trying to pre-clean the workspace on a step:
12:02:43,553 ERROR - Step 'master>Deploy>Deploy to Segments?SEGMENT=1>Deploy to Segment>Deploy to Servers?SERVER=0>Deploy to Server' is failed: Failed to delete file 'C:\QB\agent\prod\workspace\1319\DeployTool\DeployTool'.

It doesn't happen every time.

  • replies 1
  • views 20
  • stars 0
robinshen ADMIN ·

To investigate the issue, please download the handle tool and placed it into C:

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