Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -264,7 +264,7 @@ public static void deleteRecursively(File file, FilenameFilter filter)
// On Unix systems, use operating system command to run faster
// If that does not work out, fallback to the Java IO way
// We exclude Apple Silicon test environment due to the limited resource issues.
if (isUnix && filter == null && !(isMac && isTesting())) {
if (shouldTryUnixNativeRm()) {
try {
deleteRecursivelyUsingUnixNative(file);
return;
Expand Down Expand Up @@ -691,6 +691,16 @@ public static boolean isTesting() {
return System.getenv("SPARK_TESTING") != null || System.getProperty("spark.testing") != null;
}

/**
* Indicates whether Unix native rm binaries should be tried.
*/
public static boolean shouldTryUnixNativeRm() {
Boolean shouldSkipUnixNativeRm = Boolean.parseBoolean(
System.getProperty("spark.skipUnixNativeRm", "false")
);
return isUnix && filter == null && !(shouldSkipUnixNativeRm) && !(isMac && isTesting());
}

/**
* The `os.name` system property.
*/
Expand Down