Skip to content

Commit

Permalink
Fix delete model cache on macOS causing model deploy fail with model …
Browse files Browse the repository at this point in the history
…content changed error (opensearch-project#2180) (opensearch-project#2181)

Signed-off-by: zane-neo <zaniu@amazon.com>
(cherry picked from commit a159498)

Co-authored-by: zane-neo <zaniu@amazon.com>
  • Loading branch information
opensearch-trigger-bot[bot] and zane-neo authored Mar 6, 2024
1 parent 8dc55ed commit f7e0f62
Showing 1 changed file with 6 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@
import java.io.InputStream;
import java.io.OutputStream;
import java.nio.file.Path;
import java.security.AccessController;
import java.security.PrivilegedAction;
import java.util.ArrayList;
import java.util.HashSet;
import java.util.List;
Expand Down Expand Up @@ -153,7 +155,10 @@ public static void deleteFileQuietly(Path path) {

public static void deleteFileQuietly(File file) {
if (file.exists()) {
org.apache.commons.io.FileUtils.deleteQuietly(file);
AccessController.doPrivileged((PrivilegedAction<Void>) () -> {
org.apache.commons.io.FileUtils.deleteQuietly(file);
return null;
});
}
}

Expand Down

0 comments on commit f7e0f62

Please sign in to comment.