diff options
author | Bill Hoffman <bill.hoffman@kitware.com> | 2008-03-26 17:14:16 (GMT) |
---|---|---|
committer | Bill Hoffman <bill.hoffman@kitware.com> | 2008-03-26 17:14:16 (GMT) |
commit | 3827991e87422aaa47cda3d9af0899e777b85ec0 (patch) | |
tree | bc45d2ee43bef120bad8a62c6df6cee849751982 | |
parent | e5e65b5b8844687299faa5ac36e5f8286f9413f1 (diff) | |
download | CMake-3827991e87422aaa47cda3d9af0899e777b85ec0.zip CMake-3827991e87422aaa47cda3d9af0899e777b85ec0.tar.gz CMake-3827991e87422aaa47cda3d9af0899e777b85ec0.tar.bz2 |
ENH: try to fix dashboard issue with not being able to remove try compile code
-rw-r--r-- | Source/cmCoreTryCompile.cxx | 22 |
1 files changed, 19 insertions, 3 deletions
diff --git a/Source/cmCoreTryCompile.cxx b/Source/cmCoreTryCompile.cxx index 0135db4..7ac06d8 100644 --- a/Source/cmCoreTryCompile.cxx +++ b/Source/cmCoreTryCompile.cxx @@ -359,9 +359,25 @@ void cmCoreTryCompile::CleanupFiles(const char* binDir) { if(!cmSystemTools::RemoveFile(fullPath.c_str())) { - std::string m = "Remove failed on file: "; - m += fullPath; - cmSystemTools::ReportLastSystemError(m.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: "; + m += fullPath; + cmSystemTools::ReportLastSystemError(m.c_str()); + } } } } |