ENH: try to fix dashboard issue with not being able to remove try compile code

This commit is contained in:
Bill Hoffman 2008-03-26 13:14:16 -04:00
parent e5e65b5b88
commit 3827991e87
1 changed files with 19 additions and 3 deletions

View File

@ -358,6 +358,21 @@ void cmCoreTryCompile::CleanupFiles(const char* binDir)
else else
{ {
if(!cmSystemTools::RemoveFile(fullPath.c_str())) if(!cmSystemTools::RemoveFile(fullPath.c_str()))
{
bool removed = false;
int numAttempts = 0;
// sometimes anti-virus software hangs on to
// new files and we can not delete them, so try
// 5 times with .5 second delay between tries.
while(!removed && numAttempts < 5)
{
cmSystemTools::Delay(500);
if(cmSystemTools::RemoveFile(fullPath.c_str()))
{
removed = true;
}
}
if(!removed)
{ {
std::string m = "Remove failed on file: "; std::string m = "Remove failed on file: ";
m += fullPath; m += fullPath;
@ -367,6 +382,7 @@ void cmCoreTryCompile::CleanupFiles(const char* binDir)
} }
} }
} }
}
} }
void cmCoreTryCompile::FindOutputFile(const char* targetName) void cmCoreTryCompile::FindOutputFile(const char* targetName)