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)

Signed-off-by: zane-neo <zaniu@amazon.com>
  • Loading branch information
zane-neo authored and austintlee committed Mar 18, 2024
1 parent f555156 commit f19013e
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 f19013e

Please sign in to comment.