Browse Source

BuildDirServiceImpl#eraseLocalRepo 方法中需要判断 dir 是否存在

reghao 1 month ago
parent
commit
ee4483388c

+ 4 - 2
mgr/src/main/java/cn/reghao/devops/mgr/ops/build/service/impl/BuildDirServiceImpl.java

@@ -98,8 +98,10 @@ public class BuildDirServiceImpl implements BuildDirService {
         String localRepo = LocalBuildDir.localRepo + File.separator + appId;
         File dir = new File(localRepo);
         try {
-            FileUtils.cleanDirectory(dir);
-        } catch (IOException e) {
+            if (dir.exists()) {
+                FileUtils.cleanDirectory(dir);
+            }
+        } catch (Exception e) {
             log.error("{}", e.getMessage());
         }
     }