Skip to content

Commit df72d8c

Browse files
author
Marcelo Vanzin
committed
[SPARK-9710] [test] Fix RPackageUtilsSuite when R is not available.
RUtils.isRInstalled throws an exception if R is not installed, instead of returning false. Fix that.
1 parent f9c2a2a commit df72d8c

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

core/src/main/scala/org/apache/spark/api/r/RUtils.scala

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,11 @@ private[spark] object RUtils {
6767

6868
/** Check if R is installed before running tests that use R commands. */
6969
def isRInstalled: Boolean = {
70-
val builder = new ProcessBuilder(Seq("R", "--version"))
71-
builder.start().waitFor() == 0
70+
try {
71+
val builder = new ProcessBuilder(Seq("R", "--version"))
72+
builder.start().waitFor() == 0
73+
} catch {
74+
case e: Exception => false
75+
}
7276
}
7377
}

0 commit comments

Comments
 (0)