[Cmake-commits] CMake branch, next, updated. v2.8.3-912-g46d280d

Brad King brad.king at kitware.com
Wed Dec 15 15:03:37 EST 2010


This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "CMake".

The branch, next has been updated
       via  46d280d85d694aff5780dd64b717893f2c002d1f (commit)
       via  097294e6670ccfb3e2ca8101dc6468e917042600 (commit)
      from  e8836b266d9bdd0a5ea3c61c4837bcf59af3fd49 (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=46d280d85d694aff5780dd64b717893f2c002d1f
commit 46d280d85d694aff5780dd64b717893f2c002d1f
Merge: e8836b2 097294e
Author:     Brad King <brad.king at kitware.com>
AuthorDate: Wed Dec 15 15:03:35 2010 -0500
Commit:     CMake Topic Stage <kwrobot at kitware.com>
CommitDate: Wed Dec 15 15:03:35 2010 -0500

    Merge topic 'try_compile-RemoveFile' into next
    
    097294e Fix try_compile RemoveFile anti-virus loop (#11503)


http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=097294e6670ccfb3e2ca8101dc6468e917042600
commit 097294e6670ccfb3e2ca8101dc6468e917042600
Author:     Brad King <brad.king at kitware.com>
AuthorDate: Fri Dec 3 07:38:15 2010 -0500
Commit:     Brad King <brad.king at kitware.com>
CommitDate: Fri Dec 3 07:38:15 2010 -0500

    Fix try_compile RemoveFile anti-virus loop (#11503)
    
    Commit 3827991e (...fix...not being able to remove try compile code,
    2008-03-26) introduced a loop of RemoveFile attempts to overcome
    anti-virus locks on recently created try_compile executables.  Fix the
    logic in this loop to work when the file is already missing.

diff --git a/Source/cmCoreTryCompile.cxx b/Source/cmCoreTryCompile.cxx
index b8a0c95..b116204 100644
--- a/Source/cmCoreTryCompile.cxx
+++ b/Source/cmCoreTryCompile.cxx
@@ -396,28 +396,18 @@ void cmCoreTryCompile::CleanupFiles(const char* binDir)
           }
         else
           {
-          if(!cmSystemTools::RemoveFile(fullPath.c_str()))
+          // Sometimes anti-virus software hangs on to new files so we
+          // cannot delete them immediately.  Try a few times.
+          int tries = 5;
+          while(!cmSystemTools::RemoveFile(fullPath.c_str()) &&
+                --tries && cmSystemTools::FileExists(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;
-                }
-              numAttempts++;
-              }
-            if(!removed)
-              {
-              std::string m = "Remove failed on file: ";
-              m += fullPath;
-              cmSystemTools::ReportLastSystemError(m.c_str());
-              }
+            cmSystemTools::Delay(500);
+            }
+          if(tries == 0)
+            {
+            std::string m = "Remove failed on file: " + fullPath;
+            cmSystemTools::ReportLastSystemError(m.c_str());
             }
           }
         }

-----------------------------------------------------------------------

Summary of changes:
 Source/cmCoreTryCompile.cxx |   32 +++++++++++---------------------
 1 files changed, 11 insertions(+), 21 deletions(-)


hooks/post-receive
-- 
CMake


More information about the Cmake-commits mailing list